-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrgbmatrix.sh
executable file
·40 lines (32 loc) · 982 Bytes
/
rgbmatrix.sh
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
#! /bin/sh
### BEGIN INIT INFO
# Provides: main.py
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
# If you want a command to always run, put it here
# Special sudo with access to original PATH
alias mysudo='sudo -E env "PATH=$PATH"'
# Carry out specific functions when asked to by the system
case "$1" in
start)
echo "Starting matrix controller"
mysudo python /usr/local/bin/pi-wall-art/src/main.py &
;;
stop)
echo "Stopping matrix controller"
pkill -f /usr/local/bin/pi-wall-art/src/main.py
;;
*)
echo "Usage: /etc/init.d/rgbmatrix.sh {start|stop}"
exit 1
;;
esac
exit 0
# Copy into /etc/init.d
# sudo cp rgbmatrix.sh /etc/init.d
# sudo update-rc.d rgbmatrix.sh defaults
# Manual start: sudo /etc/init.d/rgbmatrix.sh start
# Based on: https://howchoo.com/g/mwnlytk3zmm/how-to-add-a-power-button-to-your-raspberry-pi