-
-
Save morriq/0ddf52d1a29913c516a0ee21a691363e to your computer and use it in GitHub Desktop.
fan
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/bash | |
# /etc/init.d/fan | |
### BEGIN INIT INFO | |
# Provides:fan | |
# Required-Start:$remote_fs $syslog | |
# Required-Stop:$remote_fs $syslog | |
# Default-Start:2 3 4 5 | |
# Default-Stop:0 1 6 | |
# Short-Description: fan | |
# Description: Fan controller auto start after boot | |
### END INIT INFO | |
case "$1" in | |
start) | |
echo "Starting Fan" | |
python3 /home/pi/Scripts/fan.py & | |
;; | |
stop) | |
echo "Stopping Fan" | |
#killall ledblink.py | |
kill $(ps aux | grep -m 1 'python3 /home/pi/Scripts/fan.py' | awk '{ print $2 }') | |
;; | |
*) | |
echo "Usage: service fan 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