X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=irqbalance.init;h=1c7ffd03561c6fd7865c3d846550f274cff529ca;hb=2251678abba2caa35f794ef7ffdc313ad990b2af;hp=6fbf7c2c6c243e46a9446ce68e89c88174d93eea;hpb=2e0a9649d9fb01042462426ec54b6b91b2f4b8ba;p=packages%2Firqbalance.git diff --git a/irqbalance.init b/irqbalance.init index 6fbf7c2..1c7ffd0 100644 --- a/irqbalance.init +++ b/irqbalance.init @@ -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