Created
March 29, 2014 18:14
-
-
Save asiletto/9859329 to your computer and use it in GitHub Desktop.
init script for rpi temp logger & terrarium controller
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/templog | |
# ### BEGIN INIT INFO | |
# Provides: templog | |
# Required-Start: | |
# Required-Stop: | |
# Should-Start: | |
# Should-Stop: | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
### END INIT INFO | |
case "$1" in | |
start) | |
echo -n "Starting temperature logger: " | |
echo -n "loading w1-gpio and w1-therm modules" | |
/sbin/modprobe w1-gpio | |
/sbin/modprobe w1-therm | |
echo -n "setting gpio 1,2,3,15 to out" | |
/usr/local/bin/gpio mode 1 out | |
/usr/local/bin/gpio mode 2 out | |
/usr/local/bin/gpio mode 4 out | |
/usr/local/bin/gpio mode 15 out | |
cd /root/raspberry.js.be/ | |
HOME=/root | |
export DB_NAME=xxxxxxxxxxx | |
export DB_HOST_NAME=xxxxxxxxxxxxx | |
export DB_PORT=xxxxxxxxxx | |
export DB_USER_NAME=xxxxxxxxx | |
export DB_PASSWORD=xxxxxxxxxx | |
/usr/local/bin/forever start run-cron.js | |
;; | |
stop) | |
echo -n "Shutting down temperature logger:" | |
HOME=/root | |
/usr/local/bin/forever stop 0 | |
;; | |
*) | |
echo "Usage: $0 {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