Last active
June 20, 2020 19:28
-
-
Save TheRealEdDawson/5351939 to your computer and use it in GitHub Desktop.
A simple shell script to run a Python program at boot time on Raspberry Pi.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# /etc/init.d/BootPython | |
### BEGIN INIT INFO | |
# Provides: Runs a Python script on startup | |
# Required-Start: BootPython start | |
# Required-Stop: BootPython stop | |
# Default-Start: 2 3 4 5 | |
# Default-stop: 0 1 6 | |
# Short-Description: Simple script to run python program at boot | |
# Description: Runs a python program at boot | |
### END INIT INFO | |
case "$1" in | |
start) | |
echo "Starting BootPython" | |
sudo python /home/pi/Ed-Python-Code/photocell/photocell.py | |
;; | |
stop) | |
echo "Stopping BootPython" | |
sudo killall Python | |
;; | |
*) | |
echo "Usage: /etc/init.d/BootPython {start|stop}" | |
exit 1 | |
;; | |
esac | |
exit 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes. ;-) I suppose I could track the process ids and only halt those related to the project.