mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2024-11-25 06:26:15 +00:00
7e287b563a
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>
19 lines
383 B
Bash
19 lines
383 B
Bash
#!/bin/sh
|
|
|
|
[ -e "/etc/config/ubihealthd" ] && exit 0
|
|
[ ! -e "/sys/class/ubi" ] && exit 0
|
|
|
|
touch "/etc/config/ubihealthd"
|
|
|
|
for ubidev in /sys/class/ubi/*/total_eraseblocks; do
|
|
ubidev="${ubidev%/*}"
|
|
ubidev="${ubidev##*/}"
|
|
uci batch <<EOF
|
|
set ubihealthd.$ubidev=ubi-device
|
|
set ubihealthd.$ubidev.device="/dev/$ubidev"
|
|
set ubihealthd.$ubidev.enable=1
|
|
EOF
|
|
done
|
|
|
|
uci commit ubihealthd
|