Skip to content

Instantly share code, notes, and snippets.

@joeheyming
Created June 16, 2018 19:30
Show Gist options
  • Save joeheyming/142e13731cc960a13babb6a809c1f33d to your computer and use it in GitHub Desktop.
Save joeheyming/142e13731cc960a13babb6a809c1f33d to your computer and use it in GitHub Desktop.
Garage door init
#! /bin/bash
# /etc/init.d/garagerelay
# Carry out specific functions when asked to by the system
case "$1" in
start)
echo "Starting Relay"
/usr/local/bin/gpio write 7 0
/usr/local/bin/gpio mode 7 out
/usr/local/bin/gpio write 0 0
/usr/local/bin/gpio mode 0 out
/home/pi/node/bin/node /home/pi/garage/server.js &
;;
stop)
echo "Stopping gpio"
;;
*)
echo "Usage: /etc/init.d/garagerelay {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