Last active
November 12, 2017 11:36
-
-
Save guillochon/0f85a62eb442e45d826e5ac27c5e17fe to your computer and use it in GitHub Desktop.
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/bash | |
# | |
# astrochats Astrochats Slackin | |
# | |
# chkconfig: 345 70 30 | |
# Source function library. | |
. /etc/init.d/functions | |
PATH=/bin:/usr/bin:/sbin:/usr/sbin | |
DAEMON=slackin | |
LOCKFILE=/var/lock/subsys/astrochats | |
LOGFILE=/var/log/astrochats.log | |
PIDFILE=/var/run/astrochats.pid | |
SLACKKEY=$(cat /root/slackkey) | |
start() { | |
echo -n "Starting astrochats: " | |
$DAEMON astrochats $SLACKKEY --port 30861 --interval 60000 --hostname localhost > $LOGFILE 2>&1 & | |
PID=$! | |
echo $PID > $PIDFILE | |
RETVAL=$? | |
echo -n | |
[ $RETVAL = 0 ] && echo -e '[\e[32m OK \e[m]' | |
[ $RETVAL = 0 ] && touch $LOCKFILE | |
return $RETVAL | |
} | |
stop() { | |
echo -n "Shutting down astrochats: " | |
killproc -p $PIDFILE node | |
RETVAL=$? | |
echo | |
[ $RETVAL = 0 ] && rm -f $LOCKFILE $PIDFILE | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
status) | |
status | |
;; | |
restart) | |
stop | |
start | |
;; | |
*) | |
echo "Usage: oacapi {start|stop|status|restart}" | |
exit 1 | |
;; | |
esac | |
exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment