#! /bin/sh # # nec_smdr # # Starts a monitoring daemon which does outgoing call accounting. # # Author: Jason Healy # # Version: $Id: nec_smdr 773 2006-10-28 13:26:14Z jhealy $ # set -e PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DESC="NEC SMDR Accounting" NAME=nec_smdr DAEMON=/usr/local/sbin/$NAME PIDFILE=/var/run/$NAME SCRIPTNAME=/etc/init.d/$NAME # Gracefully exit if the package has been removed. test -x $DAEMON || exit 0 # # Function that starts the daemon/service. # d_start() { start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON } # # Function that stops the daemon/service. # d_stop() { start-stop-daemon --stop --quiet --pidfile $PIDFILE } case "$1" in start) echo -n "Starting $DESC: $NAME" d_start echo "." ;; stop) echo -n "Stopping $DESC: $NAME" d_stop echo "." ;; restart|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". # echo -n "Restarting $DESC: $NAME" d_stop sleep 1 d_start echo "." ;; *) echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0