#! /bin/sh # /etc/init.d/sdmr ### BEGIN INIT INFO # Provides: SMDR # Required-Start: postgresql # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Description: SMDR Accounting ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DESC="SMDR Accounting" NAME=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 || { echo "$DAEMON not installed"; if [ "$1" = "stop" ]; then exit 0; else exit 6; fi; } # Shell functions sourced from /etc/rc.status . /etc/rc.status # Reset status of this service rc_reset # Function that starts the daemon/service. d_start() { # start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON /sbin/startproc $DAEMON; rc_status -v; } # Function that stops the daemon/service. d_stop() { # start-stop-daemon --stop --quiet --pidfile $PIDFILE /sbin/killproc -TERM $DAEMON; rc_status -v; } 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 "." ;; status) /sbin/checkproc $DAEMON rc_status -v ;; *) echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0