#!/bin/sh # Start/stop the dstar dvrptr # ### BEGIN INIT INFO # Provides: dvrptr # Required-Start: # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: dvrptr # Description: dvrptr ### END INIT INFO . /lib/lsb/init-functions DVRPTR_SH=/usr/local/bin/dvrptr.sh DVRPTR_BIN=/usr/local/bin/dvrptr DVRPTR_PIDFILE=/usr/local/dvrptr.sh_pidfile start() { status_of_proc $DVRPTR_SH >/dev/null RETVAL=$? if [ "$RETVAL" = "0" ] ; then echo "$DVRPTR_SH already running" else /bin/rm -rf $DVRPTR_PIDFILE echo -n "Starting $DVRPTR_SH:" start-stop-daemon --make-pidfile --pidfile $DVRPTR_PIDFILE --exec $DVRPTR_SH -S & log_end_msg $? fi } stop() { start-stop-daemon --pidfile $DVRPTR_PIDFILE --retry 5 -K start-stop-daemon --exec $DVRPTR_BIN --retry 5 -K /bin/rm -rf $DVRPTR_PIDFILE } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; status) echo -n "$DVRPTR_SH " status_of_proc $DVRPTR_SH echo -n "$DVRPTR_BIN " status_of_proc $DVRPTR_BIN ;; *) log_action_msg "Usage: /etc/init.d/dvrptr {start|stop|restart|status}" exit 2 ;; esac exit 0