diff options
Diffstat (limited to 'src/opensips/opensips.init')
-rwxr-xr-x | src/opensips/opensips.init | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/opensips/opensips.init b/src/opensips/opensips.init new file mode 100755 index 0000000..1c883c4 --- /dev/null +++ b/src/opensips/opensips.init @@ -0,0 +1,50 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +BINNAME=opensips +OSRDIR=/usr/sbin +OPENSIPS=$OSRDIR/$BINNAME + +TMPDIR=/var/tmp +CORE=$TMPDIR/core + +ETC=/etc/opensips/opensips.cfg +PIDFILE=/var/run/opensips.pid + +case "$1" in + start) + stat_busy "Starting OpenSIPS server" + cd $TMPDIR + $OPENSIPS -f $ETC -w $TMPDIR -P $PIDFILE 2>&1 > /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon opensips + stat_done + fi + ;; + stop) + stat_busy "Stopping OpenSIPS server" + if [ -r $PIDFILE ] + then + cat $PIDFILE | xargs kill + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon opensips + stat_done + fi + else + stat_fail + fi + ;; + restart) + $0 stop + sleep 3 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac |