Skip to content

Instantly share code, notes, and snippets.

@rbocchinfuso
Created September 10, 2015 15:21
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 rbocchinfuso/a0495f209eeae43cbb29 to your computer and use it in GitHub Desktop.
Save rbocchinfuso/a0495f209eeae43cbb29 to your computer and use it in GitHub Desktop.
hubot starup script
#!/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