File: l2tpns.script

package info (click to toggle)
l2tpns 2.4.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,892 kB
  • sloc: ansic: 22,125; sh: 177; perl: 139; makefile: 132
file content (93 lines) | stat: -rw-r--r-- 1,558 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
#
# Startup script for l2tpns
#
# chkconfig: 2345 83 25
# description: l2tpns.
# processname: l2tpns
# pidfile: /var/run/l2tpns.pid
# config: /etc/l2tpns

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

if [ -f /etc/sysconfig/lt2pns ]; then
        . /etc/sysconfig/lt2pns
fi

# Path to the l2tpns-monitor script, server binary, and short-form for messages.
l2tpns_monitor=/usr/sbin/l2tpns-monitor
l2tpns=/usr/sbin/l2tpns
prog=${l2tpns##*/}
RETVAL=0

start() {
        echo -n $"Starting $prog: "
	rm -f /tmp/l2tpns.stop
        daemon --check=$prog $l2tpns_monitor $OPTIONS
        RETVAL=$?
	echo
	sleep 5
	pid=`pidofproc $l2tpns_monitor`
	if [ -z "$pid" ] || [ "$pid" -eq 0 ]; then
		echo -n "Error starting $prog"
		echo_failure
		echo
		return 99
	fi
        [ $RETVAL = 0 ] && touch /var/lock/subsys/l2tpns
        return $RETVAL
}
stop() {
	echo -n $"Stopping $prog: "
	echo >/tmp/l2tpns.stop
	killproc $l2tpns
	RETVAL=$?
	echo
	[ $RETVAL = 0 ] && rm -f /var/lock/subsys/l2tpns /var/run/l2tpns.pid
}
reload() {
	echo -n $"Reloading $prog: "
	killproc $l2tpns -HUP
	RETVAL=$?
	echo
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
        status $l2tpns
	RETVAL=$?
	;;
  restart)
	stop
	sleep 5
	start
	;;
  condrestart)
	if [ -f /var/run/l2tpns.pid ] ; then
		stop
		start
	fi
	;;
  reload)
        reload
	;;
  coldrestart)
	stop
	sleep 10
	rm -f /tmp/l2tpns.dump
	start
	;;
  *)
	echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|coldrestart}"
	exit 1
esac

exit $RETVAL