#!/bin/dash # Description: EZTABLES allows you to setup a complex firewall based on IPtables with a few easy rules. CONFIG=/etc/eztables/eztables.cfg if [ ! -e "$CONFIG" ] then echo "Config $CONFIG not found." exit 1 fi stop_eztables () { /usr/sbin/eztables stop $1 exit $? } start_eztables () { /usr/sbin/eztables start $1 exit $? } usage () { echo "Usage: $0 [ start | stop | restart | status ] " } case "$1" in start) start_eztables $2 ;; stop) stop_eztables $2 ;; restart) stop_eztables sleep 1 start_eztables ;; status) [ $(iptables -L -n | wc -l) -gt 10 ] && echo "eztables is running" || echo "eztables is stopped." ;; *) usage ;; esac