parser: switch pkg_free(tob) to free_to(tob) to free To header structure
[sip-router] / pkg / ser / gentoo / files / siprouter.init
1 #!/sbin/runscript
2 # Copyright 1999-2011 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4 # $Header: $
5
6 depend() {
7         need net
8 }
9
10 check_config() {
11         out=`(/usr/sbin/siprouter -f ${CONFIGFILE} -c > /dev/null || true) 2>&1`
12         echo "$out" | grep -q 'config file ok, exiting...'
13         if [ "$?" == 1 ]; then
14                 echo -e "There are errors in the configuration. Please fix them first"
15                 echo -e "\n$out\n"
16                 return 1
17         fi
18 }
19
20 start() {
21         check_config || return 1
22         ebegin "Starting siprouter"
23         start-stop-daemon --start --quiet --pidfile /var/run/siprouter.pid \
24                 --exec /usr/sbin/siprouter -- -P /var/run/siprouter.pid \
25                 ${SR_OPTS}
26         eend $?
27 }
28
29 stop() {
30         ebegin "Stopping siprouter"
31         start-stop-daemon --stop --quiet --pidfile /var/run/siprouter.pid
32         eend $?
33 }
34