Last active
February 10, 2016 02:59
-
-
Save kenzo0107/c6c713835918c3a75159 to your computer and use it in GitHub Desktop.
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 | |
who=$(whoami) | |
if [ "${who}" != "root" ]; then | |
echo "Usage: sudo bin/hubot (start|stop|restart|status). 'sudo' is requied ! Please again.\n" | |
exit 1; | |
fi | |
ARG1=$1 | |
if [ "${ARG1}" == "" ]; then | |
echo "missing param. sudo bin/hubot (start|stop|restart|status). Please again." | |
exit 1; | |
fi | |
set -e | |
npm install | |
export PATH="node_modules/.bin:node_modules/hubot/node_modules/.bin:$PATH" | |
export HUBOT_SLACK_TOKEN=xoxb-xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxx | |
export PORT=80 | |
#exec node_modules/.bin/hubot --name "hubot" "$@" | |
start() { | |
forever start -c coffee node_modules/.bin/hubot -a slack | |
} | |
stop () { | |
forever stop -c coffee node_modules/.bin/hubot | |
} | |
status() { | |
forever list | |
} | |
restart() { | |
forever restartall | |
} | |
case "$ARG1" in | |
"stop" ) | |
stop | |
;; | |
"restart" ) | |
restart | |
;; | |
"start" ) | |
start | |
;; | |
"status" ) | |
status | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment