SOURCES: irqbalance.init - use functions - add chkconfig - actuall...

glen glen at pld-linux.org
Wed Dec 13 19:42:44 CET 2006


Author: glen                         Date: Wed Dec 13 18:42:44 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions
- add chkconfig
- actually do something with RETVAL
- skip very early on UP

---- Files affected:
SOURCES:
   irqbalance.init (1.4 -> 1.5) 

---- Diffs:

================================================================
Index: SOURCES/irqbalance.init
diff -u SOURCES/irqbalance.init:1.4 SOURCES/irqbalance.init:1.5
--- SOURCES/irqbalance.init:1.4	Wed Dec 13 17:12:52 2006
+++ SOURCES/irqbalance.init	Wed Dec 13 19:42:38 2006
@@ -1,7 +1,7 @@
 #!/bin/sh
 # $Id$
 #
-# irqbalance:	Sets up fbcon video modes.
+# irqbalance:	Balancing of IRQs between multiple CPUs
 #
 #
 # chkconfig:	2345 01 99
@@ -9,6 +9,11 @@
 #
 # config:	/etc/sysconfig/irqbalance
 
+# useless on UP
+if [ "$(LC_ALL=C grep "^processor.*:.*[0-9]" /proc/cpuinfo | wc -l)" -lt 2 ]; then
+	exit 0
+fi
+
 # Source function library
 . /etc/rc.d/init.d/functions
 
@@ -17,48 +22,53 @@
 	. /etc/sysconfig/irqbalance
 fi
 
-# useless on UP
-if [ "$(LC_ALL=C grep "^processor.*:.*[0-9]" /proc/cpuinfo | wc -l)" -lt 2 ]; then
-    exit 0
-fi
-
 is_yes "$IRQBALANCE_ONE_SHOT" && IRQBALANCE_OPT="${IRQBALANCE_OPT} oneshot"
 
-# See how we were called.
-case "$1" in
-  start)
+start() {
 	# Check if service is already running?
 	if [ ! -f /var/lock/subsys/irqbalance ]; then
-	    msg_starting irqbalance
-	    daemon irqbalance ${IRQBALANCE_OPT}
-	    RETVAL=$?
-	    [ $RETVAL -eq 0 ] && ! is_yes "$IRQBALANCE_ONE_SHOT" && touch /var/lock/subsys/irqbalance
+		msg_starting irqbalance
+		daemon irqbalance ${IRQBALANCE_OPT}
+		RETVAL=$?
+		[ $RETVAL -eq 0 ] && ! is_yes "$IRQBALANCE_ONE_SHOT" && touch /var/lock/subsys/irqbalance
 	else
-    	    msg_already_running irqbalance
+		msg_already_running irqbalance
 	fi
-	;;
-  stop)
-  	if ! is_yes "$IRQBALANCE_ONE_SHOT"; then
+}
+
+stop() {
+	if ! is_yes "$IRQBALANCE_ONE_SHOT"; then
 		if [ -f /var/lock/subsys/irqbalance ]; then
-		    msg_stopping irqbalance
-    		    killproc irqbalance
-		    rm -f /var/lock/subsys/irqbalance
+			msg_stopping irqbalance
+			killproc irqbalance
+			rm -f /var/lock/subsys/irqbalance
 		else
-		    msg_not_running irqbalance
+			msg_not_running irqbalance
 		fi
 	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+  	start
+	;;
+  stop)
+  	stop
 	;;
   status)
   	status irqbalance
-	RESULT=$?
+	RETVAL=$?
 	;;
   restart|force-reload)
-	$0 stop
-	$0 start
+	stop
+	start
 	;;
   *)
 	msg_usage "$0 {start|stop|restart|force-reload|status}"
 	exit 3
 esac
 
-exit 0
+exit $RETVAL
+# vim:ts=4:sw=4
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/irqbalance.init?r1=1.4&r2=1.5&f=u



More information about the pld-cvs-commit mailing list