diff --git a/init/loggers b/init/loggers new file mode 100644 index 0000000..abce8f4 --- /dev/null +++ b/init/loggers @@ -0,0 +1,37 @@ +#! /bin/sh +# /etc/init.d/loggers + +### BEGIN INIT INFO +# Provides: loggers +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Simple script to start a program at boot +# Description: A simple script from www.stuffaboutcode.com which will start / stop a program a boot / shutdown. +### END INIT INFO + +# If you want a command to always run, put it here + +# Carry out specific functions when asked to by the system +case "$1" in + start) + echo "Starting loggers" + kill -9 $(cat /root/dataLogger.pid) + # run application you want to start + /usr/bin/python /home/poconsole/datalogger/dataLogger.py > /dev/null 2>&1 & echo $! > "/root/dataLogger.pid" + + ;; + stop) + echo "Stopping loggers" + # kill application you want to stop + kill -9 $(cat /root/dataLogger.pid) + +;; + *) + echo "Usage: /etc/init.d/loggers {start|stop}" + exit 1 + ;; +esac + +exit 0