From fc888714bdd141be3f217a00bddff4f8dfa041b3 Mon Sep 17 00:00:00 2001 From: Ragnar Jensen Date: Wed, 5 Oct 2016 21:16:19 +0200 Subject: [PATCH] Create netledPi sysV init script To start netledPi automatically at boot. Copy script to /etc/init.d run update-rc.d enable netledPi --- initscripts/sysVinit/netledPi | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 initscripts/sysVinit/netledPi diff --git a/initscripts/sysVinit/netledPi b/initscripts/sysVinit/netledPi new file mode 100644 index 0000000..eed5077 --- /dev/null +++ b/initscripts/sysVinit/netledPi @@ -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 + +: