irqbalance/irqbalance.init

102 lines
1.9 KiB
Plaintext
Raw Normal View History

#! /bin/sh
2007-07-05 20:05:02 +00:00
### BEGIN INIT INFO
# Provides: irqbalance
# Default-Start: 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop irqbalance daemon
# Description: The irqbalance daemon will distribute interrupts across
# the cpus on a multiprocessor system with the purpose of
# spreading the load
#
### END INIT INFO
2005-01-11 04:41:13 +00:00
# chkconfig: 2345 13 87
# This is an interactive program, we need the current locale
# Source function library.
. /etc/init.d/functions
# Check that we're a priviledged user
[ `id -u` = 0 ] || exit 0
prog="irqbalance"
# Check that networking is up.
if [ "$NETWORKING" = "no" ]
then
exit 0
fi
[ -f /usr/sbin/irqbalance ] || exit 0
# fetch configuration if it exists
# ONESHOT=yes says to wait for a minute, then look at the interrupt
# load and balance it once; after balancing exit and do not change
# it again.
# The default is to keep rebalancing once every 10 seconds.
ONESHOT=
[ -f /etc/sysconfig/irqbalance ] && . /etc/sysconfig/irqbalance
case "$ONESHOT" in
y*|Y*|on) ONESHOT=--oneshot ;;
*) ONESHOT= ;;
esac
RETVAL=0
start() {
2007-11-05 12:59:14 +00:00
if [ -n "$ONESHOT" -a -f /var/run/irqbalance.pid ]; then
exit 0
fi
echo -n $"Starting $prog: "
2006-11-15 15:23:48 +00:00
if [ -n "$IRQ_AFFINITY_MASK" ];
then
2006-12-12 16:43:01 +00:00
export IRQBALANCE_BANNED_CPUS=$IRQ_AFFINITY_MASK
2006-11-15 15:23:48 +00:00
fi
2007-11-05 12:59:14 +00:00
daemon irqbalance $ONESHOT
RETVAL=$?
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc irqbalance
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/irqbalance
return $RETVAL
}
restart() {
stop
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status irqbalance
;;
restart|reload)
restart
;;
condrestart)
[ -f /var/lock/subsys/irqbalance ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
exit 1
2006-12-12 16:43:01 +00:00
;;
esac
exit $?