Skip to content

Instantly share code, notes, and snippets.

@ik5 ik5/ahn
Last active Aug 10, 2016

Embed
What would you like to do?
Adhearsion init script
#!/bin/bash
### 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
You can’t perform that action at this time.