Skip to content

Instantly share code, notes, and snippets.

@kenzo0107
Last active February 10, 2016 02:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenzo0107/c6c713835918c3a75159 to your computer and use it in GitHub Desktop.
Save kenzo0107/c6c713835918c3a75159 to your computer and use it in GitHub Desktop.
#!/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