1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
#!/bin/sh
#
### BEGIN INIT INFO
# Provides: apf-firewall
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start apf-firewall at boot time
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/apf
INAME="apf-firewall"
DESC="easy iptables based firewall system"
LOGDIR=/var/log # Log directory to use
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
# Include defaults if available
if [ -f /etc/default/$INAME ] ; then
. /etc/default/$INAME
fi
# Use this if you want the user to explicitly set 'RUN' in
# /etc/default/
if [ "x$RUN" != "xyes" ] ; then
log_failure_msg "$INAME disabled, please adjust the configuration to your needs "
log_failure_msg "and then set RUN to 'yes' in /etc/default/$INAME to enable it."
exit 0
fi
set -e
case "$1" in
start)
log_daemon_msg "Starting $DESC " "$INAME"
/usr/sbin/apf --start >> /dev/null 2>&1
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $DESC" "$INAME"
/usr/sbin/apf --stop >> /dev/null 2>&1
log_end_msg $?
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$INAME"
log_end_msg $?
$0 stop
$0 start
;;
reload)
log_daemon_msg "Reloading $DESC configuration files" "$iNAME"
/usr/sbin/apf --refresh >> /dev/null 2>&1
log_end_msg $?
;;
*)
N=/etc/init.d/$INAME
echo "Usage: $N {start|stop|restart|force-reload|reload}" >&2
exit 1
;;
esac
exit 0
|