Created
May 8, 2015 17:32
-
-
Save davoclavo/297d321795c0cb19df24 to your computer and use it in GitHub Desktop.
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/doorbot | |
### BEGIN INIT INFO | |
# Provides: doorbot | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Simple script to start doorbot | |
# Description: Simple script to start doorbot | |
### END INIT INFO | |
# If you want a command to always run, put it here | |
# Carry out specific functions when asked to by the system | |
case "$1" in | |
start) | |
echo "Starting doorbot" | |
# run application you want to start | |
cd /home/pi/doorbot | |
rvmsudo rails server & | |
ngrok --subdomain=hackyourspace 3000 & | |
;; | |
stop) | |
echo "Stopping doorbot" | |
# kill application you want to stop | |
sudo kill `pgrep -f rails` | |
sudo kill `pgrep -f ngrok` | |
;; | |
*) | |
echo "Usage: /etc/init.d/doorbot {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