Create netledPi sysV init script

To start netledPi automatically at boot.
Copy script to /etc/init.d
run update-rc.d enable netledPi
This commit is contained in:
Ragnar Jensen 2016-10-05 21:16:19 +02:00 committed by GitHub
parent 062316cd73
commit fc888714bd
1 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,48 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: netledPi
# Required-Start: $network
# Required-Stop:
# Should-Start:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the netledPi daemon
# Description: A daemon that blinks an LED connected to a GPIO pin on network activity
### END INIT INFO
PATH=/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin
NAME=netledPi
DESC="Network 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 network activity light
log_daemon_msg "Starting $DESC" "$NAME"
netledPi -d
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 netledPi
log_end_msg $?
;;
*)
echo "Usage: netledPi [start|stop]" >&2
exit 3
;;
esac
: