SOURCES: openvpn.init - use functions

glen glen at pld-linux.org
Mon Oct 2 22:21:39 CEST 2006


Author: glen                         Date: Mon Oct  2 20:21:39 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions

---- Files affected:
SOURCES:
   openvpn.init (1.23 -> 1.24) 

---- Diffs:

================================================================
Index: SOURCES/openvpn.init
diff -u SOURCES/openvpn.init:1.23 SOURCES/openvpn.init:1.24
--- SOURCES/openvpn.init:1.23	Fri Jun 16 08:59:33 2006
+++ SOURCES/openvpn.init	Mon Oct  2 22:21:33 2006
@@ -48,10 +48,7 @@
 	return $ret
 }
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+start() {
 	if [ -z "$TUNNELS" ]; then
 		nls "No tunnels configured in /etc/sysconfig/openvpn"
 		exit 6
@@ -75,8 +72,9 @@
 	else
 		msg_already_running "OpenVPN"
 	fi
-	;;
-  stop)
+}
+
+stop() {
 	if tunlsup; then
 		# Stop daemons.
 		msg_stopping "OpenVPN"; started
@@ -91,17 +89,16 @@
 	else
 		msg_not_running "OpenVPN"
 	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+  	start
 	;;
-  status)
-	nls "Configured tunnels:"
-   	echo " $TUNNELS"
-	nls "Currently active tunnels:"
-	for tun in $TUNNELS; do
-		tunlup $tun && echo -n " $tun($(cat /var/run/openvpn/$tun.pid))"
-	done
-	echo ""
-	status openvpn
-	exit $?
+  stop)
+  	stop
 	;;
   reload|force-reload)
 	if tunlsup; then
@@ -117,9 +114,20 @@
 	fi
 	;;
   restart)
-	$0 stop "$TUNNELS"
+	stop
 	sleep 1
-	$0 start "$TUNNELS"
+	start
+	exit $?
+	;;
+  status)
+	nls "Configured tunnels:"
+   	echo " $TUNNELS"
+	nls "Currently active tunnels:"
+	for tun in $TUNNELS; do
+		tunlup $tun && echo -n " $tun($(cat /var/run/openvpn/$tun.pid))"
+	done
+	echo ""
+	status openvpn
 	exit $?
 	;;
   *)
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/openvpn.init?r1=1.23&r2=1.24&f=u



More information about the pld-cvs-commit mailing list