Sophie

Sophie

distrib > Altlinux > 4.1 > i586 > media > core-src > by-pkgid > 0b3f4d8a0e35494243e0fe0691f7ef12 > files > 4

irqbalance-0.55-alt1.src.rpm

#!/bin/sh
#
# irqbalance       Start/Stop irq balancing daemon
#
# chkconfig: - 13 87
# description: The irqbalance daemon will distribute interrupts across  \
#              the cpus on a multiprocessor system with the purpose of \
#              spreading the load. \
# processname: irqbalance
# config: /etc/sysconfig/irqbalance
# pidfile: /var/run/irqbalance.pid

# Do not load RH compatibility interface.
WITHOUT_RC_COMPAT=1

# Source function library.
. /etc/init.d/functions

#PIDFILE=/var/run/irqbalance.pid
LOCKFILE=/var/lock/subsys/irqbalance
IRQBALANCE_BIN=/usr/sbin/irqbalance
RETVAL=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


start()
{
	start_daemon --lockfile "$LOCKFILE" --expect-user root -- $IRQBALANCE_BIN $ONESHOT
	RETVAL=$?
	return $RETVAL
}

stop()
{
	stop_daemon --lockfile "$LOCKFILE" --expect-user root -- $IRQBALANCE_BIN
	RETVAL=$?
	return $RETVAL
}

restart()
{
	stop
	start
}

# See how we were called.
case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart)
		restart
		;;
	condstop)
		if [ -e "$LOCKFILE" ]; then
			stop
		fi
		;;
	condrestart)
		if [ -e "$LOCKFILE" ]; then
			restart
		fi
		;;
	status)
		status --expect-user root -- $IRQBALANCE_BIN
		RETVAL=$?
		;;
	*)
		msg_usage "${0##*/} {start|stop|restart|condstop|condrestart|status}"
		RETVAL=1
esac

exit $RETVAL