Created
September 10, 2015 15:21
-
-
Save rbocchinfuso/a0495f209eeae43cbb29 to your computer and use it in GitHub Desktop.
hubot starup script
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 | |
USER="hubot" | |
USER_HOME="/home/$USER" | |
HUBOT_ROOT="$USER_HOME/hubot" | |
HUBOT_HOME="$HUBOT_ROOT/node_modules/hubot" | |
DAEMON="$HUBOT_HOME/bin/hubot" | |
PIDFILE=$HUBOT_ROOT/hubot.pid | |
case "$1" in | |
start) | |
echo "Starting" | |
. $HUBOT_ROOT/bin/.hubotrc | |
/sbin/start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile -d $HUBOT_ROOT --exec $DAEMON | |
echo "." | |
;; | |
debug) | |
echo "Debug mode: no backgrounding" | |
. $HUBOT_ROOT/bin/.hubotrc | |
/sbin/start-stop-daemon --start --pidfile $PIDFILE --make-pidfile -d $HUBOT_ROOT --exec $DAEMON | |
echo "." | |
;; | |
stop) | |
echo "Stopping" | |
/sbin/start-stop-daemon --stop --pidfile $PIDFILE | |
echo "." | |
;; | |
restart) | |
echo "Restarting" | |
/sbin/start-stop-daemon --stop --pidfile $PIDFILE | |
. $HUBOT_ROOT/bin/.hubotrc | |
/sbin/start-stop-daemon --start --pidfile $PIDFILE --make-pidfile --background -d $HUBOT_ROOT --exec $DAEMON | |
echo "." | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart|debug}" >&2 | |
exit 1 | |
;; | |
esac | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment