| 1 |
#!/bin/sh |
| 2 |
### BEGIN INIT INFO |
| 3 |
# Provides: iptotal |
| 4 |
# Required-Start: $remote_fs $syslog |
| 5 |
# Required-Stop: $remote_fs $syslog |
| 6 |
# Default-Start: 2 3 4 5 |
| 7 |
# Default-Stop: 0 1 6 |
| 8 |
# Short-Description: monitor for IP traffic, not requiring SNMP |
| 9 |
# Description: This scripts start, restart and stop iptotal traffic |
| 10 |
# monitoring tool. |
| 11 |
### END INIT INFO |
| 12 |
|
| 13 |
PATH=/sbin:/bin:/usr/sbin:/usr/bin |
| 14 |
DAEMON=/usr/sbin/iptotald |
| 15 |
NAME=iptotal |
| 16 |
DESC="IP traffic monitor" |
| 17 |
PIDFILE=/var/run/$NAME.pid |
| 18 |
|
| 19 |
test -x $DAEMON || exit 0 |
| 20 |
|
| 21 |
. /lib/lsb/init-functions |
| 22 |
|
| 23 |
# Include iptotal defaults if available |
| 24 |
if [ -f /etc/default/iptotal ] ; then |
| 25 |
. /etc/default/iptotal |
| 26 |
fi |
| 27 |
|
| 28 |
set -e |
| 29 |
|
| 30 |
case "$1" in |
| 31 |
start) |
| 32 |
if [ "$ENABLE_DAEMON" != "yes" ] && [ "$ENABLE_DAEMON" != "YES" ]; then |
| 33 |
echo "Not starting iptotald. Disabled via /etc/default/iptotal" |
| 34 |
exit 0 |
| 35 |
fi |
| 36 |
echo -n "Starting $DESC: " |
| 37 |
start-stop-daemon -b --start --quiet --pidfile $PIDFILE \ |
| 38 |
--exec $DAEMON -- $DAEMON_OPTS |
| 39 |
echo "$NAME." |
| 40 |
;; |
| 41 |
stop) |
| 42 |
echo -n "Stopping $DESC: " |
| 43 |
start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE |
| 44 |
rm -f $PIDFILE |
| 45 |
echo "$NAME." |
| 46 |
;; |
| 47 |
restart|force-reload) |
| 48 |
echo -n "Restarting $DESC: " |
| 49 |
start-stop-daemon --stop --quiet --pidfile $PIDFILE |
| 50 |
rm -f $PIDFILE |
| 51 |
sleep 1 |
| 52 |
start-stop-daemon -b --start --quiet --pidfile \ |
| 53 |
$PIDFILE --exec $DAEMON -- $DAEMON_OPTS |
| 54 |
echo "$NAME." |
| 55 |
;; |
| 56 |
force-start) |
| 57 |
echo -n "Starting $DESC: " |
| 58 |
start-stop-daemon -b --start --quiet --pidfile $PIDFILE \ |
| 59 |
--exec $DAEMON -- $DAEMON_OPTS |
| 60 |
echo "$NAME." |
| 61 |
;; |
| 62 |
status) |
| 63 |
status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $? |
| 64 |
;; |
| 65 |
*) |
| 66 |
N=/etc/init.d/$NAME |
| 67 |
echo "Usage: $N {start|stop|restart|force-reload|force-start}" >&2 |
| 68 |
exit 1 |
| 69 |
;; |
| 70 |
esac |