Created
January 6, 2012 16:51
-
-
Save mattsgarrison/1571390 to your computer and use it in GitHub Desktop.
Start/Stop script to manage Hubot with Monit
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/zsh | |
### BEGIN INIT INFO | |
# Provides: hubot | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the hubot service | |
# Description: starts the Hubot bot for the Campfire rooms | |
### END INIT INFO | |
NAME="Hubot" | |
HUBOT_HOME="/home/rails/hubot" | |
LOGFILE="$HUBOT_HOME/hubot.log" | |
PIDFILE="$HUBOT_HOME/hubot.pid" | |
DAEMON="$HUBOT_HOME/bin/hubot" | |
DAEMON_OPTS="-a campfire -n cpt" | |
set -e | |
case "$1" in | |
start) | |
echo -n "Starting $NAME: " | |
start-stop-daemon --start -v --chdir $HUBOT_HOME --pidfile $PIDFILE -c rails:rails --make-pidfile --background --exec $DAEMON -- $DAEMON_OPTS | |
echo $PIDFILE | |
;; | |
stop) | |
echo -n "Stopping $NAME: " | |
start-stop-daemon --stop --pidfile $PIDFILE | |
echo $PIDFILE | |
;; | |
restart) | |
echo -n "Restarting $NAME: " | |
start-stop-daemon --stop --pidfile $PIDFILE | |
start-stop-daemon --start -v --chdir $HUBOT_HOME --pidfile $PIDFILE -c rails:rails --make-pidfile --background --exec $DAEMON -- $DAEMON_OPTS | |
echo $PIDFILE | |
;; | |
*) | |
N=/etc/init.d/$NAME | |
echo "Usage: $N {start|stop}" >&2 | |
exit 1 | |
;; | |
esac | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment