97 lines
1.7 KiB
Bash
Executable file
97 lines
1.7 KiB
Bash
Executable file
#!/bin/bash
|
|
#
|
|
# ser This shell script takes care of starting and stopping
|
|
# the sip express router.
|
|
#
|
|
# chkconfig: - 80 30
|
|
# description: Ser is a fast SIP Proxy.
|
|
# processname: ser
|
|
# config: /etc/ser/ser.cfg
|
|
# pidfile: /var/run/ser.pid
|
|
### BEGIN INIT INFO
|
|
# Provides: lsb-ser
|
|
# Required-Start: $local_fs $network $remote_fs
|
|
# Required-Stop: $local_fs $network $remote_fs
|
|
# Default-Start: 2 3 4 5
|
|
# Default-Stop: 0 1 6
|
|
# Short-Description: start and stop the SIP express Router
|
|
# Description: Ser is a fast SIP Proxy.
|
|
### END INIT INFO
|
|
|
|
# Source function library.
|
|
. /etc/rc.d/init.d/functions
|
|
|
|
# Source ser configureation.
|
|
if [ -f /etc/sysconfig/ser ] ; then
|
|
. /etc/sysconfig/ser
|
|
else
|
|
HTTPUSER=apache
|
|
fi
|
|
|
|
ser=/usr/sbin/ser
|
|
prog=ser
|
|
RETVAL=0
|
|
|
|
start() {
|
|
echo -n $"Starting $prog: "
|
|
daemon $ser $OPTIONS
|
|
RETVAL=$?
|
|
echo
|
|
[ $RETVAL = 0 ] && touch /var/lock/subsys/ser
|
|
return $RETVAL
|
|
}
|
|
|
|
stop() {
|
|
echo -n $"Stopping $prog: "
|
|
killproc $ser
|
|
RETVAL=$?
|
|
echo
|
|
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/ser /var/run/ser.pid
|
|
}
|
|
|
|
reload() {
|
|
echo -n $"Reloading $prog: "
|
|
killproc $ser -HUP
|
|
RETVAL=$?
|
|
echo
|
|
}
|
|
|
|
fixperm() {
|
|
# Correct permissions of the ser_fifo file, to allow the webinterface
|
|
# communicate with the ser daemon.
|
|
if [ -d /usr/share/serweb ]; then
|
|
chgrp $HTTPUSER /tmp/ser_fifo
|
|
fi
|
|
}
|
|
|
|
# See how we were called.
|
|
case "$1" in
|
|
start)
|
|
start
|
|
fixperm
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
status)
|
|
status $ser
|
|
RETVAL=$?
|
|
;;
|
|
restart)
|
|
stop
|
|
start
|
|
fixperm
|
|
;;
|
|
condrestart)
|
|
if [ -f /var/run/ser.pid ] ; then
|
|
stop
|
|
start
|
|
fixperm
|
|
fi
|
|
;;
|
|
*)
|
|
echo $"Usage: $prog {start|stop|restart|condrestart|status|help}"
|
|
exit 1
|
|
esac
|
|
|
|
exit $RETVAL
|