Revert "Revert "and added files""
[bcm963xx.git] / userapps / opensource / siproxd / contrib / siproxd.init
1 #!/bin/bash
2 #
3 #       /etc/rc.d/init.d/siproxd
4 #
5 # Starts the siproxd daemon
6 #
7 # chkconfig: 345 94 80
8 #
9 # description: Listen and dispatch SIP messages 
10 # processname: siproxd 
11
12 # Source function library.
13 . /etc/rc.d/init.d/functions
14
15 [ -x /usr/sbin/siproxd ] || exit 0
16
17 RETVAL=0
18
19 #
20 # See how we were called.
21 #
22
23 start() {
24         # Check if it is already running
25         if [ ! -f /var/lock/subsys/siproxd ]; then
26             echo -n $"Starting sip proxy: "
27             daemon /usr/sbin/siproxd
28             RETVAL=$?
29             [ $RETVAL -eq 0 ] && touch /var/lock/subsys/siproxd
30             echo
31         fi
32         return $RETVAL
33 }
34
35 stop() {
36         echo -n $"Stopping sip proxy: "
37         killproc /usr/sbin/siproxd
38         RETVAL=$?
39         [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/siproxd
40         echo
41         return $RETVAL
42 }
43
44
45 restart() {
46         stop
47         start
48 }       
49
50 reload() {
51         trap "" SIGHUP
52         killall -HUP siproxd
53 }       
54
55 case "$1" in
56 start)
57         start
58         ;;
59 stop)
60         stop
61         ;;
62 reload)
63         reload
64         ;;
65 restart)
66         restart
67         ;;
68 condrestart)
69         if [ -f /var/lock/subsys/siproxd ]; then
70             restart
71         fi
72         ;;
73 status)
74         status siproxd
75         ;;
76 *)
77         echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
78         exit 1
79 esac
80
81 exit $RETVAL