-
-
Save andrius/6286911 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 | |
### BEGIN INIT INFO | |
# Provides: ahn | |
# Required-Start: ahn daemon | |
# Required-Stop: ahn daemon | |
# chkconfig: 2345 91 60 | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Adhearsion daemon | |
# Description: This is a Adhearsion daemon init script | |
### END INIT SCRIPT | |
# Source function library. | |
[ -e /etc/rc.d/init.d/functions ] && . /etc/rc.d/init.d/functions | |
NAME=Adhearsion | |
AHN=/usr/bin/ahn | |
APP_PATH=/var/<replace me>/ | |
pid="$(pidof ahn)" | |
case "$1" in | |
start) | |
$AHN daemon $APP_PATH | |
;; | |
stop) | |
$AHN stop $APP_PATH | |
;; | |
restart) | |
$AHN restart $APP_PATH | |
;; | |
rotate) | |
[ -n "$pid" ] && (kill -1 $pid ; echo "Sent rotation signal" ) || echo "Adhearsion not running" | |
;; | |
trace) | |
[ -n "$pid" ] && (kill -14 $pid ; echo "Toggeled trace signal" ) || echo "Adhearsion not running" | |
;; | |
status) | |
echo -n "Adhearsion is " | |
[ -n "$pid" ] && echo "running" || echo "not running" | |
;; | |
*) | |
echo "Usage: ahn {start|stop|restart|rotate|trace|status}" | |
exit 1 | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment