-
-
Save spruce/cfdc5551e7946dfb5c7b to your computer and use it in GitHub Desktop.
Scripts to start automatically start hubot on startup on debian
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/bash | |
export PORT=5555 # setting port for hubot scripts, only needed if port 8080 is not ok with you | |
export BIND_ADDRESS=127.0.0.1 # So that hubot is not public under port but can be proxied through e.g. nginx | |
export HUBOT_HIPCHAT_JID="[email protected]" # set HipChatid | |
export HUBOT_HIPCHAT_PASSWORD="YOUR_PASSWORD_HERE" # setting password for HipChat | |
export GITLAB_CHANNEL="[email protected]" # channel to which to send the GITLAB messages |
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
First file place under: /etc/init.d/hubot | |
Second file place under: /home/hubot/.hubotrc | |
Don't forget to execute | |
update-rc.d hubot defaults |
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 | |
# 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 HipChat rooms | |
### END INIT INFO | |
PATH=/home/hubot/node_modules/hubot/bin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
NAME="Hubot" | |
LOGFILE="/var/log/hubot.log" | |
PIDFILE="/var/run/hubot.pid" | |
HOME="/home/hubot" | |
DAEMON="$HOME/node_modules/hubot/bin/hubot -- --adapter hipchat" | |
set -e | |
start(){ | |
echo -n "Starting $NAME: " | |
. /home/hubot/.hubotrc | |
echo "Trying to start Hubot" > $LOGFILE | |
start-stop-daemon -S -p $PIDFILE -c hubot:hubot -m -b -d $HOME -x $DAEMON >> $LOGFILE 2>&1 | |
# ^Start pidfile chuid make-pid background changedir execute | |
echo "Success" | |
} | |
stop(){ | |
echo -n "Stopping $NAME: " | |
start-stop-daemon -K -p $PIDFILE >> $LOGFILE 2>&1 | |
echo "Success" | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
stop | |
start | |
;; | |
*) | |
N=/etc/init.d/$NAME | |
echo "Usage: $N {start|stop|restart}" >&2 | |
exit 1 | |
;; | |
esac | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment