Generic Init Scripts added

This commit is contained in:
Patrick McDonagh
2016-02-02 13:40:25 -06:00
parent 18ddf73db8
commit 0d1bc7b088
2 changed files with 81 additions and 0 deletions

40
init/loggers Executable file
View File

@@ -0,0 +1,40 @@
#! /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/solar_ww.pid)
# run application you want to start
#python /home/poconsole/src/dataLogger/alarmLogger.py &
#python /home/poconsole/src/dataLogger/dataLogger.py &
/usr/bin/python /home/poconsole/tagserver/python/tagserver_SQLite.py > /dev/null 2>&1 & echo $! > "/root/solar_ww.pid"
;;
stop)
echo "Stopping loggers"
# kill application you want to stop
#killall python
kill -9 $(cat /root/solar_ww.pid)
;;
*)
echo "Usage: /etc/init.d/loggers {start|stop}"
exit 1
;;
esac
exit 0

41
init/website Executable file
View File

@@ -0,0 +1,41 @@
#! /bin/sh
# /etc/init.d/website
### BEGIN INIT INFO
# Provides: website
# 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 website"
# run application you want to start
# /home/pi/runWebsite.sh
if [ $(ps aux | grep $USER | grep node | grep -v grep | wc -l | tr -s "\n") -eq 0 ]
then
export NODE_ENV=production
export PATH=/usr/local/bin:$PATH
forever start /home/poconsole/tagserver/www/app.js > /dev/null
fi
;;
stop)
echo "Stopping website"
# kill application you want to stop
forever stopall
;;
*)
echo "Usage: /etc/init.d/website {start|stop}"
exit 1
;;
esac
exit 0