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
#
# Startup script for Kamailio
#
# chkconfig: 345 85 15
# description: Kamailio is a fast, reliable and flexible SIP Server.
# processname: kamailio
# pidfile: /var/run/kamailio/kazoo-kamailio.pid
# config: /etc/kazoo/kamailio/kamailio.cfg
#
RETVAL=0
PID_FILE=${PID_FILE:-/var/run/kamailio/kazoo-kamailio.pid}
LOCK_FILE=/var/lock/subsys/kazoo-kamailio
. /etc/rc.d/init.d/functions
start() {
echo -n $"Starting Kamailio: "
/usr/sbin/kazoo-kamailio prepare >/dev/null 2>&1
daemon --pidfile ${PID_FILE} "/usr/sbin/kazoo-kamailio start >/dev/null 2>&1"
RETVAL=$?
if [ ${RETVAL} -eq 0 ]; then
touch ${LOCK_FILE}
success $"OK"
echo
else
failure $"Kamailio is already running or failed to start!"
echo
fi
}
stop() {
echo -n $"Stopping Kamailio: "
/usr/sbin/kazoo-kamailio stop >/dev/null 2>&1
RETVAL=$?
if [ ${RETVAL} -eq 0 ]; then
rm -f ${LOCK_FILE} ${pidfile}
success $"OK"
echo
else
failure $"Kamailio is still running!"
echo
fi
}
status() {
/usr/sbin/kazoo-kamailio status
RETVAL=$?
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
check)
/usr/sbin/kazoo-haproxy check
;;
restart|reload)
restart
;;
condrestart)
[ ! -e ${LOCK_FILE} ] && restart
;;
*)
echo $"Usage: $0 (start|stop|restart|status|check)"
RETVAL=1
esac
exit ${RETVAL}