Sophie

Sophie

distrib > Mandriva > current > x86_64 > by-pkgid > 38a69bee8b59868b9a2e355f97067329 > files > 23

opensips-1.6.2-5mdv2010.1.x86_64.rpm

#!/bin/bash
#
# Startup script for OpenSIPS
#
# chkconfig: - 85 15
# description: OpenSIPS is a fast SIP Server.
#
# processname: opensips
# pidfile: /var/run/opensips.pid
# config: /etc/opensips/opensips.cfg
#
### BEGIN INIT INFO
# Provides: opensips
# Required-Start: $local_fs $network $named
# Should-Start: mysqld postgresql
# Short-Description: start, stop OpenSIPS
# Description: OpenSIPS is a very fast and flexible SIP (RFC3261) server.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

oser=/usr/sbin/opensips
prog=opensips
RETVAL=0

[ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog

start() {
	gprintf "Starting %s: " "$prog"
	# there is something at end of this output which is needed to
	# report proper [ OK ] status in Fedora scripts
	daemon $oser $OPTIONS 2>/dev/null | tail -1
	RETVAL=$?
	echo
	[ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
}

stop() {
	gprintf "Stopping %s: " "$prog"
	killproc $oser
	RETVAL=$?
	echo
	[ $RETVAL = 0 ] && rm -f /var/lock/subsys/$prog /var/run/$prog.pid
}

# See how we were called.
case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	status)
		status $oser
		RETVAL=$?
		;;
	restart|reload)
		stop
		start
		;;
	condrestart)
		if [ -f /var/run/opensips.pid ] ; then
			stop
			start
		fi
		;;
	*)
		gprintf "Usage: %s {start|stop|reload|restart|condrestart|status|help}\n" "$prog"
		exit 1
esac

exit $RETVAL