diff options
Diffstat (limited to 'sip-router/files/ser.initd')
-rw-r--r-- | sip-router/files/ser.initd | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sip-router/files/ser.initd b/sip-router/files/ser.initd new file mode 100644 index 0000000..f692395 --- /dev/null +++ b/sip-router/files/ser.initd @@ -0,0 +1,34 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +depend() { + need net +} + +check_config() { + out=`(/usr/sbin/sip-router -f ${CONFIGFILE} -c > /dev/null || true) 2>&1` + echo "$out" | grep -q 'config file ok, exiting...' + if [ "$?" == 1 ]; then + echo -e "There are errors in the configuration. Please fix them first" + echo -e "\n$out\n" + return 1 + fi +} + +start() { + check_config || return 1 + ebegin "Starting sip-router" + start-stop-daemon --start --quiet --pidfile /var/run/sip-router.pid \ + --exec /usr/sbin/sip-router -- -P /var/run/sip-router.pid \ + ${SR_OPTS} + eend $? +} + +stop() { + ebegin "Stopping sip-router" + start-stop-daemon --stop --quiet --pidfile /var/run/sip-router.pid + eend $? +} + |