123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- #! /bin/sh
- ### BEGIN INIT INFO
- # Provides: softflowd
- # Required-Start: $network $local_fs $remote_fs $syslog
- # Required-Stop: $network $local_fs $remote_fs $syslog
- # Default-Start: 2 3 4 5
- # Default-Stop: 0 1 6
- # Short-Description: Flow-based network traffic analyser.
- ### END INIT INFO
- # skeleton example file to build /etc/init.d/ scripts.
- # This file should be used to construct scripts for /etc/init.d.
- #
- # Written by Miquel van Smoorenburg <miquels@cistron.nl>.
- # Modified for Debian
- # by Ian Murdock <imurdock@gnu.ai.mit.edu>.
- #
- # Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl
- #
- PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
- DAEMON=/usr/sbin/softflowd
- NAME=softflowd
- DESC=softflowd
- DEFAULT=/etc/default/softflowd
- PRIVDROP_CHROOT_DIR=/var/run/softflowd/chroot
- test -x $DAEMON || exit 0
- INTERFACE=
- OPTIONS=
- # Include softflowd defaults if available
- if [ -f $DEFAULT ] ; then
- . $DEFAULT
- fi
- if [ "$INTERFACE" = "" ] ; then
- echo "Not starting $NAME"
- echo "Edit $DEFAULT and define the INTERFACE variable"
- exit 0
- fi
- set -e
- [ -d $PRIVDROP_CHROOT_DIR ] || mkdir -p $PRIVDROP_CHROOT_DIR
- case "$1" in
- start)
- echo -n "Starting $DESC: "
- start-stop-daemon --start --oknodo --quiet --pidfile /var/run/$NAME.pid \
- --exec $DAEMON -- -i "$INTERFACE" $OPTIONS
- echo "$NAME."
- ;;
- stop)
- echo -n "Stopping $DESC: "
- start-stop-daemon --stop --oknodo --quiet --pidfile /var/run/$NAME.pid \
- --exec $DAEMON
- echo "$NAME."
- ;;
- #reload)
- #
- # If the daemon can reload its config files on the fly
- # for example by sending it SIGHUP, do it here.
- #
- # If the daemon responds to changes in its config file
- # directly anyway, make this a do-nothing entry.
- #
- # echo "Reloading $DESC configuration files."
- # start-stop-daemon --stop --signal 1 --quiet --pidfile \
- # /var/run/$NAME.pid --exec $DAEMON
- #;;
- force-reload)
- #
- # If the "reload" option is implemented, move the "force-reload"
- # option to the "reload" entry above. If not, "force-reload" is
- # just the same as "restart" except that it does nothing if the
- # daemon isn't already running.
- # check wether $DAEMON is running. If so, restart
- start-stop-daemon --stop --test --quiet --pidfile \
- /var/run/$NAME.pid --exec $DAEMON \
- && $0 restart \
- || exit 0
- ;;
- restart)
- echo -n "Restarting $DESC: "
- start-stop-daemon --stop --oknodo --quiet --pidfile /var/run/$NAME.pid \
- --exec $DAEMON
- sleep 1
- start-stop-daemon --start --oknodo --quiet --pidfile /var/run/$NAME.pid \
- --exec $DAEMON -- -i "$INTERFACE" $OPTIONS
- echo "$NAME."
- ;;
- *)
- N=/etc/init.d/$NAME
- # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
- echo "Usage: $N {start|stop|restart|force-reload}" >&2
- exit 1
- ;;
- esac
- exit 0
|