-
Notifications
You must be signed in to change notification settings - Fork 75
/
brewonboot
50 lines (41 loc) · 1.25 KB
/
brewonboot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#! /bin/sh
# /etc/init.d/brewonboot
### BEGIN INIT INFO
# Provides: brewonboot
# 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 / st$
### END INIT INFO
# 1) Make script executable:
# sudo chmod 755 /etc/init.d/brewonboot
# 2) Register script to be run at start-up:
# sudo update-rc.d brewonboot defaults
# To remove script from start-up:
# sudo update-rc.d -f brewonboot remove
# To test starting the program:
# sudo /etc/init.d/brewonboot start
# To test stopping the program:
# sudo /etc/init.d/brewonboot stop
# 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 RasPiBrew"
# run application you want to start
python /var/www/RasPiBrew/raspibrew.py
;;
stop)
echo "Stopping RasPiBrew"
# kill application you want to stop
killall python
python /var/www/RasPiBrew/cleanupGPIO.py
;;
*)
echo "Usage: /etc/init.d/brewonboot {start|stop}"
exit 1
;;
esac
exit 0