#! /bin/sh
#
# startfile for avbf, by newbiefan @ wl500g.info
# For Olegs & Ily's FW for Asus Routers
# store this script in /opt/etc/init.d if you've installed optware

# Prgmname=/full_path/Prgmname
prgmname=/opt/sbin/avbf2_6
#prgmname="/tmp/local/bin/avbf2_6"
shortname="avbf"

###########################End of Script configuration###################

start() {
        # Code here to start the program
        ${prgmname}
        return 0
}

stop() {
        # Code here to stop the program and check it's dead
        #switch off and emty all iptables rules
        /usr/sbin/iptables -F
        /usr/sbin/iptables -X
        sleep 2
        return 0
}
##########################start here##########################
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        logger -t AVBF "All tables and own chains deleted, iptables stopped"
        ;;
  restart)
        stop
        logger -t AVBF "Restart of AVBF executed from $(whoami)"
        start
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart}"
        exit 1
esac
sleep 1
exit
