Skip to content

Instantly share code, notes, and snippets.

@asiletto
Created March 29, 2014 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asiletto/9859329 to your computer and use it in GitHub Desktop.
Save asiletto/9859329 to your computer and use it in GitHub Desktop.
init script for rpi temp logger & terrarium controller
#! /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