From eeabf6f759ba120722cc22906ecbb314ebc2451e Mon Sep 17 00:00:00 2001 From: Sascha Wessel Date: Wed, 8 Oct 2008 17:50:24 +0200 Subject: [PATCH] Added init script --- init-fso-gpsd | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100755 init-fso-gpsd diff --git a/init-fso-gpsd b/init-fso-gpsd new file mode 100755 index 0000000..c83101f --- /dev/null +++ b/init-fso-gpsd @@ -0,0 +1,60 @@ +#! /bin/sh + +### BEGIN INIT INFO +# Provides: fso-gpsd +# Required-Start: $remote_fs dbus +# Required-Stop: $remote_fs dbus +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Starts the fso gspd compatibility daemon +### END INIT INFO + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin + +NAME=fso-gpsd +DESC="the fso gpsd compatibility daemon" + +PIDDIR=/var/run/$NAME +PIDFILE=$PIDDIR/$NAME.pid + +DAEMON=/usr/sbin/fso-gpsd +DAEMON_OPTS="-P $PIDFILE" +DAEMON_USER=root + +if id -u fso-gpsd > /dev/null 2>&1; then + DAEMON_USER=fso-gpsd +fi + +test -x $DAEMON || exit 0 + +set -e + +case "$1" in + start) + echo -n "Starting $DESC: " + if [ ! -d $PIDDIR ]; then + mkdir -p $PIDDIR + chown $DAEMON_USER:$DAEMON_USER $PIDDIR + fi + start-stop-daemon --start --quiet --pidfile $PIDFILE \ + --chuid $DAEMON_USER --exec $DAEMON -- $DAEMON_OPTS + echo "$NAME." + + ;; + stop) + echo -n "Stopping $DESC: " + start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE + echo "$NAME." + ;; + restart|force-reload) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload}" + exit 1 + ;; +esac + +exit 0 -- 2.11.4.GIT