Skip to content

Instantly share code, notes, and snippets.

@febuiles
Created November 25, 2011 22:02
Show Gist options
  • Save febuiles/1394520 to your computer and use it in GitHub Desktop.
Save febuiles/1394520 to your computer and use it in GitHub Desktop.
Hubot startup script
#!/bin/sh
# This assumes you have:
# 1) A user called `hubot` in charge of the bot.
# 2) A file called /home/hubot/.hubotrc that contains the Hubot credentials.
#
# To set the adapter either edit bin/hubot to specify what you want or append
# `-- -a campfire` to the $DAEMON variable below.
#
### 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
PATH=/home/hubot/node_modules/hubot/bin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME="Hubot"
HUBOT_HOME="/home/hubot/node_modules/hubot"
LOGFILE="/var/log/hubot/hubot.log"
PIDFILE="/var/run/hubot.pid"
DAEMON="$HUBOT_HOME/bin/hubot"
set -e
case "$1" in
start)
echo -n "Starting $NAME: "
. /home/hubot/.hubotrc
start-stop-daemon --start --quiet --pidfile $PIDFILE -c hubot:hubot --make-pidfile --background --exec $DAEMON
echo "."
;;
stop)
echo -n "Stopping $NAME: "
start-stop-daemon --stop --quiet --pidfile $PIDFILE
echo "."
;;
restart)
echo -n "Restarting $NAME: "
. /home/hubot/.hubotrc
start-stop-daemon --stop --quiet --pidfile $PIDFILE
start-stop-daemon --start --quiet --pidfile $PIDFILE -c hubot:hubot --make-pidfile --background --exec $DAEMON
echo "."
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop}" >&2
exit 1
;;
esac
exit
Copy link

ghost commented Sep 11, 2014

Heya, I improved your debian init script for hubot. Thanks for the initial work on it.

https://gist.github.com/rejon/2b2dfbfe72e42e0feb0e

Please consider pulling this request :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment