Skip to content

Instantly share code, notes, and snippets.

@hardware
Created August 31, 2014 08:03
Show Gist options
  • Save hardware/e21731a31e03721a4633 to your computer and use it in GitHub Desktop.
Save hardware/e21731a31e03721a4633 to your computer and use it in GitHub Desktop.
Prelude LML - Script init.d
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: prelude-lml
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start prelude-lml sensor
### END INIT INFO
test $DEBIAN_SCRIPT_DEBUG && set -v -x
NAME=prelude-lml
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/local/bin/prelude-lml
PIDFILE=/var/run/$NAME.pid
DAEMONARGS="-d -q -P /var/run/$NAME.pid"
trap "" 1
export LANG=C
export PATH
test -f $DAEMON || exit 0
# check_prelude_profile()
# {
# if [ ! -d "/etc/prelude/profile/$NAME" ]; then
# echo "Prelude profile for $NAME was not found"
# echo "You must create it with prelude-admin (see README.Debian)"
# echo "NOT starting."
# exit 0
# fi
# }
case "$1" in
start)
echo -n "Starting Prelude LML: "
# check_prelude_profile
start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON --oknodo \
--quiet -- $DAEMONARGS > /dev/null
echo "$NAME."
;;
stop)
echo -n "Stopping Prelude LML: "
start-stop-daemon --stop --pidfile $PIDFILE --exec $DAEMON --quiet \
--oknodo > /dev/null
echo "$NAME."
;;
restart|force-restart|reload|force-reload)
echo -n "Restarting Prelude LML: "
# check_prelude_profile
start-stop-daemon --stop --pidfile $PIDFILE --exec $DAEMON --quiet \
--oknodo > /dev/null
start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON --oknodo \
--quiet -- $DAEMONARGS > /dev/null
echo "$NAME."
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
if [ $? -eq 0 ]; then
echo .
exit 0
else
echo failed
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment