Last active
October 5, 2017 15:11
-
-
Save kyleparisi/5b80ee4436c428e91ad93c160e958c71 to your computer and use it in GitHub Desktop.
hubot init script
This file contains hidden or 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 | |
### 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 with slack adapter | |
### END INIT INFO | |
PATH=/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
NAME="hubot" | |
HUBOT_HOME="/home/hubot/diggy" | |
LOGFILE="/var/log/hubot.log" | |
PIDFILE="/var/run/hubot.pid" | |
DAEMON="bin/hubot" | |
ARGUMENTS="-a slack" | |
set -e | |
case "$1" in | |
start) | |
echo -n "Starting $NAME: " | |
export $(grep -v '^#' /etc/environment | xargs) | |
start-stop-daemon --start --quiet --chdir $HUBOT_HOME --pidfile /var/run/hubot.pid -c hubot:hubot --make-pidfile --background --exec $DAEMON -- $ARGUMENTS | |
echo "." | |
;; | |
stop) | |
echo -n "Stopping $NAME: " | |
start-stop-daemon --stop --quiet --pidfile $PIDFILE | |
echo "." | |
;; | |
restart) | |
echo -n "Restarting $NAME: " | |
export $(grep -v '^#' /etc/environment | xargs) | |
start-stop-daemon --stop --quiet --pidfile $PIDFILE | |
start-stop-daemon --start --quiet --chdir $HUBOT_HOME --pidfile /var/run/hubot.pid -c hubot:hubot --make-pidfile --background --exec $DAEMON -- $ARGUMENTS | |
echo "." | |
;; | |
*) | |
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