#! /bin/sh
# Copyright (c) 1995-2002 SuSE Linux AG, Nuernberg, Germany.
# All rights reserved.
#
# /etc/init.d/irqbalance
#   and its symbolic link
# /(usr/)sbin/rcirqbalance
#
### BEGIN INIT INFO
# Provides:          irqbalance
# Required-Start:    
# X-UnitedLinux-Should-Start: 
# Required-Stop:     
# X-UnitedLinux-Should-Stop: 
# Default-Start:     1 2 3 5
# Default-Stop:      0 6
# Short-Description: irqbalance daemon providing irq balancing on MP-machines
# Description:       Start irqbalance to allow interrrupt balancing over multiple CPUs
#	             usually all irqs are handled by cpu0, this daemon dynamcally 
#	             uses all cpus for the irqs
#	
#	
#	
### END INIT INFO

# Check for missing binaries (stale symlinks should not happen)
IRQBALANCE_BIN=/usr/sbin/irqbalance
test -x $IRQBALANCE_BIN || exit 5

. /etc/rc.status

# Reset status of this service
rc_reset

case "$1" in
    start)
	echo -n "Starting irqbalance "
	startproc $IRQBALANCE_BIN

	# Remember status and be verbose
	rc_status -v
	;;
    stop)
	echo -n "Shutting down irqbalance "
	killproc -TERM $IRQBALANCE_BIN

	# Remember status and be verbose
	rc_status -v
	;;
    try-restart)
	$0 status >/dev/null &&  $0 restart

	# Remember status and be quiet
	rc_status
	;;
    restart)
	$0 stop
	$0 start

	# Remember status and be quiet
	rc_status
	;;
    force-reload)
	echo -n "Reload service irqbalance "
	## if it supports it:
	killproc -HUP $IRQBALANCE_BIN
	#touch /var/run/irqbalance.pid
	rc_status -v

	;;
    reload)
	echo -n "Reload service irqbalance "
	killproc -HUP $IRQBALANCE_BIN
	#touch /var/run/irqbalance.pid
	rc_status -v
	
	;;
    status)
	echo -n "Checking for service irqbalance "
	checkproc $IRQBALANCE_BIN
	rc_status -v
	;;
    probe)
	;;
    *)
	echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
	exit 1
	;;
esac
rc_exit
