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