You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

81 lines
1.3 KiB

#!/bin/bash
#
# kazoo
#
# chkconfig: 345 85 87
# description: Dubbed a "scalable, distributed, cloud-based" telephony platform
# processname: kazoo
#
RETVAL=0
SCRIPT_NAME=`basename "$0"`
PID_FILE=${PID_FILE:-/var/run/kazoo/${SCRIPT_NAME}.pid}
LOCK_FILE=${LOCK_FILE:-/var/lock/subsys/${SCRIPT_NAME}}
. /etc/init.d/functions
if [ "${NETWORKING}" = "no" ]; then
exit 0
fi
start() {
echo -n $"Starting ${SCRIPT_NAME}: "
/usr/sbin/${SCRIPT_NAME} prepare >/dev/null 2>&1
daemon --pidfile ${PID_FILE} "/usr/sbin/${SCRIPT_NAME} background >/dev/null 2>&1"
RETVAL=$?
if [ ${RETVAL} -eq 0 ]; then
touch ${LOCK_FILE}
success $"OK"
echo
else
failure $"Kazoo ${SCRIPT_NAME#*-} is already running or failed to start!"
echo
fi
}
stop() {
echo -n $"Stopping ${SCRIPT_NAME}: "
/usr/sbin/${SCRIPT_NAME} stop >/dev/null 2>&1
RETVAL=$?
if [ ${RETVAL} -eq 0 ]; then
rm -f ${LOCK_FILE} ${pidfile}
success $"OK"
echo
else
failure $"Kazoo ${SCRIPT_NAME#*-} is still running!"
echo
fi
}
status() {
/usr/sbin/${SCRIPT_NAME} status
RETVAL=$?
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart|reload)
restart
;;
condrestart)
[ ! -e ${LOCK_FILE} ] && restart
;;
*)
echo $"Usage: $0 (start|stop|restart|status)"
RETVAL=1
esac
exit ${RETVAL}