[PATCH v2] gemini: Add hdparm setting
Linus Walleij
linus.walleij at linaro.org
Fri Jul 23 03:29:27 PDT 2021
This uses "hdparm" (if present) to get the harddisk into low
power mode on NAS set-ups.
Cc: Adrian Schmutzler <mail at adrianschmutzler.de>
Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
---
ChangeLog v1->v2:
- Drop executable bit and !/bin/sh shebang
- Add SPDX header
- Use $(command -v ...) construct to check for hdparm
- Use $() construct instead of backticks
---
.../linux/gemini/base-files/etc/board.d/03_hdparm | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 target/linux/gemini/base-files/etc/board.d/03_hdparm
diff --git a/target/linux/gemini/base-files/etc/board.d/03_hdparm b/target/linux/gemini/base-files/etc/board.d/03_hdparm
new file mode 100644
index 000000000000..27f2b760420e
--- /dev/null
+++ b/target/linux/gemini/base-files/etc/board.d/03_hdparm
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0-only
+# Spin down drives after one minute if inactive
+
+if [ ! -n "$(command -v hdparm)" ]; then
+ exit 0
+fi
+
+DISKS=$(find /dev/sd[a-z] 2>/dev/null)
+for DISK in $DISKS
+do
+ if [ -b $DISK ] ; then
+ hdparm -S 12 $DISK > /dev/null
+ fi
+done
--
2.31.1
More information about the openwrt-devel
mailing list