SOURCES: ifplugd.init - set global per service lock, for %service

glen glen at pld-linux.org
Sun Sep 17 19:59:00 CEST 2006


Author: glen                         Date: Sun Sep 17 17:59:00 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- set global per service lock, for %service

---- Files affected:
SOURCES:
   ifplugd.init (1.9 -> 1.10) 

---- Diffs:

================================================================
Index: SOURCES/ifplugd.init
diff -u SOURCES/ifplugd.init:1.9 SOURCES/ifplugd.init:1.10
--- SOURCES/ifplugd.init:1.9	Sun Sep 17 19:50:51 2006
+++ SOURCES/ifplugd.init	Sun Sep 17 19:58:55 2006
@@ -28,43 +28,40 @@
 
 start() {
 	# Check if the service is already running?
-	for iface in $INTERFACES; do
-		if [ ! -f /var/lock/subsys/ifplugd.${iface} ]; then
-			msg_starting "Network Interface Plugging Daemon ($iface)"
-			args=$(eval echo \$\{ARGS_${IF}\})
-			[ -z "$args" ] && args="${ARGS}"
-			daemon /sbin/ifplugd -i ${iface} ${args}
-			RETVAL=$?
-			[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ifplugd.${iface}
-		else
-			msg_already_running "ifplugd ($iface)"
-		fi
-	done
+	if [ ! -f /var/lock/subsys/ifplugd ]; then
+		for iface in $INTERFACES; do
+			if [ ! -f /var/lock/subsys/ifplugd.${iface} ]; then
+				msg_starting "Network Interface Plugging Daemon ($iface)"
+				args=$(eval echo \$\{ARGS_${IF}\})
+				[ -z "$args" ] && args="${ARGS}"
+				daemon /sbin/ifplugd -i ${iface} ${args}
+				RETVAL=$?
+				[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ifplugd.${iface}
+			else
+				msg_already_running "ifplugd ($iface)"
+			fi
+		done
+		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ifplugd
+	else
+		msg_already_running "Network Interface Plugging Daemon"
+	fi
 }
 
 stop() {
-  	for iface in $INTERFACES; do
-		if [ -f /var/lock/subsys/ifplugd.${iface} ]; then
-			msg_stopping "Network Interface Plugging Daemon ($iface)"
-			daemon /sbin/ifplugd -k -i ${iface}
-			RETVAL=$?
-		else
-			msg_not_running "ifplugd ($iface)"
-		fi
-	done
-	rm -f /var/run/ifplugd.pid /var/lock/subsys/ifplugd.* >/dev/null 2>&1
-}
-
-resume() {
-	for iface in $INTERFACES; do
-		if [ -f /var/lock/subsys/ifplugd.${iface} ]; then
-			msg_starting "Network Interface Plugging Daemon (resuming $iface)"
-			daemon /sbin/ifplugd -R -i ${iface}
-			RETVAL=$?
-		else
-			msg_not_running "ifplugd ($iface)"
-		fi
-	done
+	if [ -f /var/lock/subsys/ifplugd ]; then
+		for iface in $INTERFACES; do
+			if [ -f /var/lock/subsys/ifplugd.${iface} ]; then
+				msg_stopping "Network Interface Plugging Daemon ($iface)"
+				daemon /sbin/ifplugd -k -i ${iface}
+				RETVAL=$?
+			else
+				msg_not_running "ifplugd ($iface)"
+			fi
+		done
+		rm -f /var/run/ifplugd.pid /var/lock/subsys/ifplugd* >/dev/null 2>&1
+	else
+		msg_not_running "Network Interface Plugging Daemon"
+	fi
 }
 
 [ -n "$2" ] && INTERFACES="$2"
@@ -80,6 +77,10 @@
   stop)
   	stop
 	;;
+  restart)
+	stop
+	start
+	;;
   suspend)
   	for iface in $INTERFACES; do
 		if [ -f /var/lock/subsys/ifplugd.${iface} ]; then
@@ -92,11 +93,15 @@
 	done
 	;;
   resume)
-  	resume
-	;;
-  restart)
-	stop
-	start
+	for iface in $INTERFACES; do
+		if [ -f /var/lock/subsys/ifplugd.${iface} ]; then
+			msg_starting "Network Interface Plugging Daemon (resuming $iface)"
+			daemon /sbin/ifplugd -R -i ${iface}
+			RETVAL=$?
+		else
+			msg_not_running "ifplugd ($iface)"
+		fi
+	done
 	;;
   status)
 	status /sbin/ifplugd
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/ifplugd.init?r1=1.9&r2=1.10&f=u



More information about the pld-cvs-commit mailing list