44 lines
1.1 KiB
Bash
44 lines
1.1 KiB
Bash
#! /bin/sh
|
|
# Copyright (c) 2015 HUAWEI TECHNOLOGIES CO., LTD.
|
|
# All rights reserved.
|
|
|
|
# Check for missing binaries (stale symlinks should not happen)
|
|
IRQBALANCE_BIN=/usr/sbin/irqbalance
|
|
test -x $IRQBALANCE_BIN || exit 5
|
|
|
|
IRQBALANCE_PIDFILE="/var/run/irqbalance.pid"
|
|
IRQBALANCE_CONFIG_FILE="/etc/sysconfig/irqbalance"
|
|
|
|
if [ -f $IRQBALANCE_CONFIG_FILE ]; then
|
|
. $IRQBALANCE_CONFIG_FILE
|
|
fi
|
|
|
|
# Note: There maybe IRQBALANCE_ARGS env in $IRQBALANCE_CONFIG_FILE
|
|
# So, here we should add this.
|
|
IRQBALANCE_ARGS=$IRQBALANCE_ARGS" --pid=$IRQBALANCE_PIDFILE"
|
|
|
|
if [ -n "$IRQBALANCE_BANNED_CPUS" ]; then
|
|
export IRQBALANCE_BANNED_CPUS
|
|
fi
|
|
|
|
if [ "$IRQBALANCE_ONESHOT" != "auto" ]; then
|
|
export IRQBALANCE_ONESHOT
|
|
fi
|
|
|
|
IRQS_BANNED="$IRQBALANCE_BANNED_INTERRUPTS"
|
|
if [ -n "$IRQBALANCE_BANNED_INTERRUPTS" ]; then
|
|
export IRQBALANCE_BANNED_INTERRUPTS
|
|
fi
|
|
|
|
for ban_irq in $IRQS_BANNED;
|
|
do
|
|
if [ -z "${ban_irq//[0-9]/}" ];then
|
|
IRQBALANCE_ARGS=$IRQBALANCE_ARGS" --banirq=$ban_irq"
|
|
else
|
|
echo "Bad irq number $ban_irq, please check config file!"
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
$IRQBALANCE_BIN $IRQBALANCE_ARGS
|