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 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
#! /bin/sh
# ipkungfu: An iptables-based Linux firewall
#
### BEGIN INIT INFO
# Provides: ipkungfu
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the ipkungfu firewall at boot time
# Description: Script to start/stop/reload the ipkungfu script
### END INIT INFO
#
# The user must change /etc/default/ipkungfu (as per recommendation in # Bug#315074).
# Created on 2005 by Nigel Jones <nigelj@gmail.com>
# Make LSB-compliant on 2006 by Luis Uribe <acme@eviled.org>
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/ipkungfu
NAME=ipkungfu
DESC="iptables based firewall"
LOGFILE=/var/log/ipkungfu.log
SCRIPTNAME=/etc/init.d/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
ipkf_configerr () {
echo "Not starting $NAME: Please read /usr/share/doc/ipkungfu/README.Debian for details"
exit 0
}
test -x $DAEMON || exit 0
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
if [ "$IPKFSTART" != "1" ]
then
ipkf_configerr
fi
case "$1" in
start|reload|force-reload)
#In IPKungfu reload and start are the same things...
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
if $DAEMON 2>&1 >>$LOGFILE ; then
[ "$VERBOSE" != no ] && log_end_msg 0 ;
else
[ "$VERBOSE" != no ] && log_end_msg 1 ;
fi
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
if $DAEMON -d 2>&1 >>$LOGFILE ; then
[ "$VERBOSE" != no ] && log_end_msg 0 ;
else
[ "$VERBOSE" != no ] && log_end_msg 1 ;
fi
;;
restart)
log_daemon_msg "Restarting $DESC" "$NAME"
if ! $DAEMON -d 2>&1 >>$LOGFILE ; then
[ "$VERBOSE" != no ] && log_end_msg 1 ;
fi
sleep 1
if $DAEMON 2>&1 >>$LOGFILE ; then
[ "$VERBOSE" != no ] && log_end_msg 0 ;
else
[ "$VERBOSE" != no ] && log_end_msg 1 ;
fi
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
exit 0
|