diff --git a/debian/ngcp-rate-o-mat.init b/debian/ngcp-rate-o-mat.init index bd15e1a..b0e672e 100644 --- a/debian/ngcp-rate-o-mat.init +++ b/debian/ngcp-rate-o-mat.init @@ -17,6 +17,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="rate-o-mat" NAME=rate-o-mat PACKAGE=ngcp-rate-o-mat +INTERP=/usr/bin/perl DAEMON=/usr/sbin/$NAME DAEMON_ARGS="" PIDFILE=/var/run/$NAME.pid @@ -69,10 +70,12 @@ do_start() # 0 if daemon has been started # 1 if daemon was already running # 2 if daemon could not be started - start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ + start-stop-daemon --start --quiet --test \ + --pidfile $PIDFILE --exec $INTERP --name $NAME --startas $DAEMON >/dev/null \ || return 1 - start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ - $DAEMON_ARGS \ + start-stop-daemon --start --quiet \ + --pidfile $PIDFILE --exec $INTERP --name $NAME --startas $DAEMON \ + -- $DAEMON_ARGS \ || return 2 # Add code here, if necessary, that waits for the process to be ready # to handle requests from services started subsequently which depend @@ -88,7 +91,8 @@ do_stop() # 0 if daemon has been stopped # 2 if daemon could not be stopped # other if a failure occurred - start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \ + --pidfile $PIDFILE --exec $INTERP --name $NAME [ "$?" = 2 ] && return 2 # Wait for children to finish too if this is a daemon that forks # and if the daemon is only ever run from this initscript. @@ -96,7 +100,8 @@ do_stop() # that waits for the process to drop all resources that could be # needed by services started subsequently. A last resort is to # sleep for some time. - start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON + start-stop-daemon --stop --quiet --retry=0/30/KILL/5 --oknodo \ + --pidfile $PIDFILE --exec $INTERP --name $NAME RETVAL="$?" [ "$RETVAL" = 2 ] && return 2 # daemon doesn't delete its pidfile when it exits @@ -113,7 +118,8 @@ do_reload() { # restarting (for example, when it is sent a SIGHUP), # then implement that here. # - start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME + start-stop-daemon --stop --signal 1 --quiet \ + --pidfile $PIDFILE --exec $INTERP --name $NAME return 0 }