2 # Copyright (c) 1995-2003 Bernhard Thoni <bt@tronicplanet.de>
3 # Tronicplanet Datendienst GmbH, Simbach am INN, Germany.
5 # Copyright (c) 2006-2008 Paul Wouters <paul@xelerance.com>
6 # Xeleracne Corporation
10 # and its symbolic link
14 # LSB compliant service control script; see http://www.linuxbase.org/spec/
16 # System startup script for L2TP daemon xl2tpd
20 # Required-Start: $syslog
21 # Required-Stop: $syslog
23 # Default-Stop: 0 1 2 6
24 # Short-Description: Start xl2tpd (to provide L2TP VPN's)
25 # Description: Start xl2tpd to provide L2TP VPN tunnels
26 # normally used with IPsec (openswan)
29 # Note on Required-Start: It does specify the init script ordering,
30 # not real dependencies. Depencies have to be handled by admin
31 # resp. the configuration tools (s)he uses.
33 # Source SuSE config (if still necessary, most info has been moved)
34 test -r /etc
/rc.config
&& .
/etc
/rc.config
36 # Check for missing binaries (stale symlinks should not happen)
37 XL2TPD_BIN
=/usr
/sbin
/xl2tpd
38 test -x $YPBIND_BIN ||
{ echo "$YPBIND_BIN not installed";
39 if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; }
41 # Check for existence of needed config file and read it
42 #XL2TPD_CONFIG=/etc/sysconfig/xl2tpd
43 #test -r $YPBIND_CONFIG || { echo "$YPBIND_CONFIG not existing";
44 # if [ "$1" = "stop" ]; then exit 0; else exit 6; fi; }
47 # Shell functions sourced from /etc/rc.status:
48 # rc_check check and set local and overall rc status
49 # rc_status check and set local and overall rc status
50 # rc_status -v ditto but be verbose in local rc status
51 # rc_status -v -r ditto and clear the local rc status
52 # rc_failed set local and overall rc status to failed
53 # rc_failed <num> set local and overall rc status to <num><num>
54 # rc_reset clear local rc status (overall remains)
55 # rc_exit exit appropriate to overall rc status
56 # rc_active checks whether a service is activated by symlinks
59 # First reset status of this service
62 # Return values acc. to LSB for all commands but status:
64 # 1 - generic or unspecified error
65 # 2 - invalid or excess argument(s)
66 # 3 - unimplemented feature (e.g. "reload")
67 # 4 - insufficient privilege
68 # 5 - program is not installed
69 # 6 - program is not configured
70 # 7 - program is not running
72 # Note that starting an already running service, stopping
73 # or restarting a not-running service as well as the restart
74 # with force-reload (in case signalling is not supported) are
75 # considered a success.
79 echo -n "Starting xl2tpd"
80 ## Start daemon with startproc(8). If this fails
81 ## the echo return value is set appropriate.
83 # NOTE: startproc returns 0, even if service is
84 # already running to match LSB spec.
85 startproc
$XL2TPD_BIN >/dev
/null
2>&1
87 # Remember status and be verbose
91 echo -n "Shutting down xl2tpd"
92 ## Stop daemon with killproc(8) and if this fails
93 ## set echo the echo return value.
95 killproc
-TERM $XL2TPD_BIN
96 rm -f /var
/run
/xl2tpd
/xl2tpd.pid
97 # Remember status and be verbose
100 try-restart|condrestart
)
101 ## Do a restart only if the service was active before.
102 ## Note: try-restart is now part of LSB (as of 1.9).
103 ## RH has a similar command named condrestart.
104 if test "$1" = "condrestart"; then
105 echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
111 rc_reset
# Not running is not a failure.
122 ## Signal the daemon to reload its config. Most daemons
123 ## do this on signal 1 (SIGHUP).
124 ## If it does not support it, restart.
125 echo -n "Reload service xl2tpd"
126 ## if it supports it:
127 killproc
-HUP $XL2TPD_BIN
128 #touch /var/run/xl2tpd/xl2tpd.pid
135 ## Like force-reload, but if daemon does not support
136 ## signalling, do nothing (!)
137 # If it supports signalling:
138 echo -n "Reload service xl2tpd"
139 killproc
-HUP $XL2TPD_BIN
140 #touch /var/run/xl2tpd.pid
142 ## Otherwise if it does not support reload:
147 echo -n "Checking for service xl2tpd: "
148 ## Check status with checkproc(8), if process is running
149 ## checkproc will return with exit status 0.
151 # Return value is slightly different for the status command:
152 # 0 - service running
153 # 1 - service dead, but /var/run/ pid file exists
154 # 2 - service dead, but /var/lock/ lock file exists
155 # 3 - service not running
157 # NOTE: checkproc returns LSB compliant status values.
158 checkproc
$XL2TPD_BIN
162 ## Optional: Probe for the necessity of a reload,
163 ## print out the argument which is required for a reload.
165 test /etc
/xl2tpd
/xl2tpd.conf
-nt /var
/run
/xltpd
/xl2tpd.pid
&& echo reload
168 echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"