Skip to content

Instantly share code, notes, and snippets.

@grauwoelfchen
Last active January 1, 2016 12:59
Show Gist options
  • Save grauwoelfchen/8148298 to your computer and use it in GitHub Desktop.
Save grauwoelfchen/8148298 to your computer and use it in GitHub Desktop.
Hubot runner for forever with .env file via virtualenv.
#!/bin/sh
ROOT="/var/srv/hubot"
VENV="/usr/local/virtualenvs/hubot"
# virtualenv
source $VENV/bin/activate
# env
while read -r LINE; do
VALUE="${LINE:0:1}"
if [[ -n "$VALUE" && "$VALUE" != "#" ]]; then
export "$LINE"
fi
done < $ROOT/.env
cd $ROOT
case $1 in
"start" | "stop" | "restart" )
$VENV/bin/forever $1 \
--minUptime 10 \
--spinSleepTime 100 \
--pidFile $ROOT/tmp/hubot.pid \
--append \
--verbose \
-l $ROOT/tmp/hubot.log \
-p $ROOT/tmp \
-c /bin/sh $ROOT/bin/hubot --adapter irc --name hubot
;;
* )
echo "Usage: hubot {start|stop|restart}"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment