Skip to content

Instantly share code, notes, and snippets.

@braidn
Forked from mattsgarrison/hubot_service.sh
Last active August 27, 2015 02:33
Show Gist options
  • Select an option

  • Save braidn/082dd25e1d2de4a91a60 to your computer and use it in GitHub Desktop.

Select an option

Save braidn/082dd25e1d2de4a91a60 to your computer and use it in GitHub Desktop.

Revisions

  1. @mattsgarrison mattsgarrison revised this gist Jan 6, 2012. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion hubot_service.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    #!/bin/zsh

    ### BEGIN INIT INFO
  2. @mattsgarrison mattsgarrison created this gist Jan 6, 2012.
    47 changes: 47 additions & 0 deletions hubot_service.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@

    #!/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