diff options
| author | Tim 'timtim' Ellis <tim.ellis@foonas.org> | 2009-01-24 00:43:58 +0000 |
|---|---|---|
| committer | Tim 'timtim' Ellis <tim.ellis@foonas.org> | 2009-01-24 00:43:58 +0000 |
| commit | b1777b1bdf7d5971397ac6615257af56eced2602 (patch) | |
| tree | 45b5982f912daaa8f9836334b1ee94cd61fd2a2e /packages/piccontrol/files/init | |
| parent | 1fae1769d399b1157bcb4318593cd24a2f6d45b4 (diff) | |
piccontrol: Add init script, tidy up
Diffstat (limited to 'packages/piccontrol/files/init')
| -rw-r--r-- | packages/piccontrol/files/init | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/packages/piccontrol/files/init b/packages/piccontrol/files/init new file mode 100644 index 0000000000..3f2e511183 --- /dev/null +++ b/packages/piccontrol/files/init @@ -0,0 +1,37 @@ +#! /bin/sh +# piccontrol - simple init.d piccontrol script - tim.ellis@foonas.org +set -e + +if [ ! -f /usr/sbin/piccontrol ]; then + echo -n "Warning: piccontrol binary not found. Shutting down" + shutdown -h now + exit -1 +fi + +case "$1" in + start) + echo -n "Starting piccontrol: " + rm -f /var/run/piccontrol.sock + start-stop-daemon -S -b -n piccontrol -a /usr/sbin/piccontrol -- -d + sleep 1 + piccontrol statusled greenon + piccontrol powerled on + piccontrol buzzer short + echo "done" + ;; + stop) + echo -n "Stopping piccontrol: " + start-stop-daemon -K -n piccontrol >&- 2>&- & + echo "done" + ;; + restart) + $0 stop + $0 start + ;; + *) + echo "Usage: piccontrol { start | stop | restart }" >&2 + exit 1 + ;; +esac + +exit 0 |
