Skip to content
Snippets Groups Projects
Commit bebd1393 authored by Mitchell Pomery's avatar Mitchell Pomery Committed by Mark Tearle
Browse files

Fixed init script not working correctly

parent 40879050
No related merge requests found
......@@ -19,43 +19,45 @@ PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
DAEMON_ARGS=""
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
# Say something and gracefully exit if the package has been removed.
if ! test -x $DAEMON; then
echo "Failed to find the executable $DAEMON"
exit 1
fi
d_start() {
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--nicelevel 5 \
--exec $DAEMON -- -d -sdaemon --pid-file=$PIDFILE \
start-stop-daemon --start --pidfile $PIDFILE --nicelevel 5 \
--startas $DAEMON -- -d -sdaemon --pid-file=$PIDFILE \
$DAEMON_ARGS
}
d_stop() {
start-stop-daemon --stop --quiet --pidfile $PIDFILE \
--name $NAME
start-stop-daemon --stop --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)
echo -n "Restarting $DESC: $NAME"
d_stop
sleep 1
d_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 1
;;
start)
echo -n "Starting $DESC: $NAME\n"
d_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME\n"
d_stop
echo "."
;;
restart|force-reload)
echo -n "Restarting $DESC: $NAME\n"
d_stop
sleep 1
d_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment