Browse Source

gemini: Add hdparm setting

This uses "hdparm" (if present) to get the harddisk into low
power mode on NAS set-ups.

Cc: Adrian Schmutzler <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
Linus Walleij 4 years ago
parent
commit
83441522a2
1 changed files with 14 additions and 0 deletions
  1. 14 0
      target/linux/gemini/base-files/etc/board.d/03_hdparm

+ 14 - 0
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