[openwrt/openwrt] gemini: Add hdparm setting

LEDE Commits lede-commits at lists.infradead.org
Sun Aug 8 11:34:15 PDT 2021


hauke pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/83441522a2389fd44630df3368c3eecf3cb2579f

commit 83441522a2389fd44630df3368c3eecf3cb2579f
Author: Linus Walleij <linus.walleij at linaro.org>
AuthorDate: Fri Jul 23 12:29:27 2021 +0200

    gemini: Add hdparm setting
    
    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>
---
 target/linux/gemini/base-files/etc/board.d/03_hdparm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

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 0000000000..27f2b76042
--- /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



More information about the lede-commits mailing list