Update changelog.
[l2tpns.git] / scripts / l2tpns.script
1 #!/bin/bash
2 #
3 # Startup script for l2tpns
4 #
5 # chkconfig: 2345 83 25
6 # description: l2tpns.
7 # processname: l2tpns
8 # pidfile: /var/run/l2tpns.pid
9 # config: /etc/l2tpns
10
11 # Source function library.
12 . /etc/rc.d/init.d/functions
13
14 if [ -f /etc/sysconfig/lt2pns ]; then
15         . /etc/sysconfig/lt2pns
16 fi
17
18 # Path to the l2tpns-monitor script, server binary, and short-form for messages.
19 l2tpns_monitor=/usr/sbin/l2tpns-monitor
20 l2tpns=/usr/sbin/l2tpns
21 prog=${l2tpns##*/}
22 RETVAL=0
23
24 start() {
25         echo -n $"Starting $prog: "
26         rm -f /tmp/l2tpns.stop
27         daemon --check=$prog $l2tpns_monitor $OPTIONS
28         RETVAL=$?
29         echo
30         sleep 5
31         pid=`pidofproc $l2tpns_monitor`
32         if [ -z "$pid" ] || [ "$pid" -eq 0 ]; then
33                 echo -n "Error starting $prog"
34                 echo_failure
35                 echo
36                 return 99
37         fi
38         [ $RETVAL = 0 ] && touch /var/lock/subsys/l2tpns
39         return $RETVAL
40 }
41 stop() {
42         echo -n $"Stopping $prog: "
43         echo >/tmp/l2tpns.stop
44         killproc $l2tpns
45         RETVAL=$?
46         echo
47         [ $RETVAL = 0 ] && rm -f /var/lock/subsys/l2tpns /var/run/l2tpns.pid
48 }
49 reload() {
50         echo -n $"Reloading $prog: "
51         killproc $l2tpns -HUP
52         RETVAL=$?
53         echo
54 }
55
56 # See how we were called.
57 case "$1" in
58   start)
59         start
60         ;;
61   stop)
62         stop
63         ;;
64   status)
65         status $l2tpns
66         RETVAL=$?
67         ;;
68   restart)
69         stop
70         sleep 5
71         start
72         ;;
73   condrestart)
74         if [ -f /var/run/l2tpns.pid ] ; then
75                 stop
76                 start
77         fi
78         ;;
79   reload)
80         reload
81         ;;
82   coldrestart)
83         stop
84         sleep 10
85         rm -f /tmp/l2tpns.dump
86         start
87         ;;
88   *)
89         echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|coldrestart}"
90         exit 1
91 esac
92
93 exit $RETVAL