Last active
January 1, 2016 12:59
-
-
Save grauwoelfchen/8148298 to your computer and use it in GitHub Desktop.
Hubot runner for forever with .env file via virtualenv.
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 | |
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