]> git.pld-linux.org Git - packages/irqbalance.git/commitdiff
- use functions
authorElan Ruusamäe <glen@pld-linux.org>
Wed, 13 Dec 2006 18:42:38 +0000 (18:42 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
- add chkconfig
- actually do something with RETVAL
- skip very early on UP

Changed files:
    irqbalance.init -> 1.5

irqbalance.init

index 6fbf7c2c6c243e46a9446ce68e89c88174d93eea..1c7ffd03561c6fd7865c3d846550f274cff529ca 100644 (file)
@@ -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 @@ if [ -f /etc/sysconfig/irqbalance ]; then
        . /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
This page took 0.077748 seconds and 4 git commands to generate.