From: Serge L. <sma...@us...> - 2007-11-26 09:51:21
|
Update of /cvsroot/devil-linux/build/scripts/scripts In directory sc8-pr-cvs12.sourceforge.net:/tmp/cvs-serv21602 Added Files: openl2tpd Log Message: - init script for openl2tpd --- NEW FILE: openl2tpd --- #! /bin/bash # # description: OpenL2TP is a complete implementation of RFC2661 - Layer Two Tunneling # Protocol Version 2, able to operate as both a server and a client. It # can be used to implement L2TP VPNs. As a server, it can handle # hundreds of tunnels and sessions. ### BEGIN INIT INFO # Provides: openl2tpd # Required-Start: $network $syslog $named $portmap # Required-Stop: $network $syslog $named # Default-Start: 3 5 # Default-Stop: 0 1 6 # Description: Start/Stop the OpenL2TP protocol daemon. ### END INIT INFO # settings source /etc/sysconfig/config # parameters NAME="OpenL2TPD" CONFIGNAME=L2TPD DAEMON=/usr/sbin/openl2tpd PARAMETER= # source function library source /etc/init.d/functions source /etc/sysconfig/openl2tpd eval START=\$START_$CONFIGNAME # Determine the base and follow a runlevel link name. base=${0##*/} link=${base#*[SK][0-9][0-9]} # Force execution if not called by a runlevel directory. test $link = $base && START=yes test "$START" = "yes" || exit 0 if [ ! -e $DAEMON ]; then echo echo "$DAEMON not found. Did you install the package?" exit 1 fi # See how we were called. prog="openl2tpd" start() { echo -n $"Starting $NAME: " if [ -e /var/lock/subsys/openl2tpd ]; then if [ -e /var/run/openl2tpd.pid ] && [ -e /proc/`cat /var/run/openl2tpd.pid` ]; then echo -n $"cannot start openl2tpd: openl2tpd is already running."; failure $"cannot start openl2tpd: openl2tpd already running."; echo return 1 fi fi modprobe -s --first-time pppol2tp RETVAL=$? if [ $RETVAL -eq 0 ]; then loadproc $DAEMON $OPENL2TPDARGS fi RETVAL=$? echo if [ $RETVAL -eq 0 ]; then touch /var/lock/subsys/openl2tpd if [ -n "$OPENL2TPD_CONFIG_FILE" ]; then sleep 1 echo $"Restoring saved openl2tpd configuration..." /usr/bin/l2tpconfig config restore file=$OPENL2TPD_CONFIG_FILE RETVAL=$? fi fi return $RETVAL } stop() { echo -n $"Stopping $prog: " if [ ! -e /var/lock/subsys/openl2tpd ]; then echo -n $"cannot stop openl2tpd: openl2tpd is not running." failure $"cannot stop openl2tpd: openl2tpd is not running." echo return 1; fi killproc openl2tpd RETVAL=$? modprobe -s -r pppol2tp echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/openl2tpd; return $RETVAL } rhstatus() { status openl2tpd } restart() { stop start } reload() { echo -n $"Reloading openl2tp daemon configuration: " stop start RETVAL=$? echo return $RETVAL } case "$1" in start) start ;; stop) stop ;; restart) restart ;; reload) reload ;; status) rhstatus ;; condrestart) [ -f /var/lock/subsys/openl2tpd ] && restart || : ;; *) echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}" exit 1 esac |