0
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-11-22 04:56:15 +00:00
openwrt/package/utils/mtd-utils/files/ubihealthd.init
Daniel Golle 7e287b563a
mtd-utils: add ubihealthd to nand-utils
Add ubihealthd to the nand-utils package, auto-create UCI config for
each UBI device and launch the daemon on boot.

The default time interval between scrubbing a random PED is 120 seconds
which means that a fully used 128 MiB flash chip gets scrubbed in about
a day and a half. The interval can be adjusted in UCI using the
'interval' option.

Suggested-by: Rodrigo Balerdi <lanchon@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Link: https://github.com/openwrt/openwrt/pull/16973
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-11-18 15:18:39 +01:00

28 lines
548 B
Bash

#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
PROG=/usr/sbin/ubihealthd
ubihealthd_instance() {
local cfg="$1"
local device interval enable
config_get_bool enable "$cfg" "enable" 1
[ "$enable" = "1" ] || return 0
config_get device "$cfg" "device"
config_get interval "$cfg" "interval"
procd_open_instance
procd_set_param command "$PROG" -f -d "$device"
[ -n "$interval" ] && procd_append_param command -i "$interval"
procd_close_instance
}
start_service() {
config_load ubihealthd
config_foreach ubihealthd_instance ubi-device
}