1
0
mirror of https://git.openwrt.org/feed/packages.git synced 2024-06-27 11:25:26 +02:00
openwrt-packages/utils/irqbalance/files/irqbalance.init
Hannu Nyman 4f0c847828 irqbalance: fix socket directory and create it
Irqbalance defines /run/irqbalance dir for its socket
communication between irqbalance and its UI. /run does not exist
in OpenWrt (although it is defined by the Linux FHS), so the
socket creation fails. Although we do not compile UI and thus
the issue is not critical to us, fix the directory location.

Additionally, the creation is originally handled by a systemd
init script that we do not use.

* patch source to define dir as /var/run/irqbalance
* create the dir in the procd init script.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2020-06-17 23:29:13 +03:00

37 lines
668 B
Bash

#!/bin/sh /etc/rc.common
START=90
STOP=10
USE_PROCD=1
service_triggers()
{
procd_add_reload_trigger "irqbalance"
}
start_service() {
local enabled
config_load 'irqbalance'
config_get_bool enabled irqbalance enabled 0
[ "$enabled" -gt 0 ] || return 0
mkdir -p /var/run/irqbalance
# 10 is the default
config_get interval irqbalance interval 10
# A list of IRQ's to ignore
banirq=""
handle_banirq_value()
{
banirq="$banirq -i $1"
}
config_list_foreach irqbalance banirq handle_banirq_value
procd_open_instance "irqbalance"
procd_set_param command /usr/sbin/irqbalance -f -t "$interval" "$banirq"
procd_set_param respawn
procd_close_instance
}