Create hddledPi sysV init script

To start hddledPi automatically at boot.
Copy script to /etc/init.d
run update-rc.d enable hddledPi
This commit is contained in:
Ragnar Jensen 2016-10-05 21:13:17 +02:00 committed by GitHub
parent 0567e2bea0
commit 062316cd73

View File

@ -0,0 +1,48 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: hddledPi
# Required-Start: $local_fs
# Required-Stop:
# Should-Start:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Start the hddledPi daemon
# Description: A daemon that blinks an LED connected to a GPIO pin on disk activity
### END INIT INFO
PATH=/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin
NAME=hddledPi
DESC="Disk activity light"
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
. /lib/init/vars.sh
do_start () {
# Start disk activity light
log_daemon_msg "Starting $DESC" "$NAME"
hddledPi -d -r 20
log_end_msg $?
}
case "$1" in
start|"")
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
killall hddledPi
log_end_msg $?
;;
*)
echo "Usage: hddledPi [start|stop]" >&2
exit 3
;;
esac
: