[PATCH] gemini: Add hdparm setting

Adrian Schmutzler mail at adrianschmutzler.de
Sun Jul 4 15:54:51 PDT 2021


Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Linus Walleij
> Sent: Montag, 5. Juli 2021 00:01
> To: Sebastian Luft <sebastian.luft at gmail.com>; Hans Ulli Kroll
> <ulli.kroll at googlemail.com>; Hauke Mehrtens <hauke at hauke-m.de>;
> Christian Lamparter <chunkeey at gmail.com>
> Cc: Florian Fainelli <f.fainelli at gmail.com>; openwrt-devel at lists.openwrt.org;
> Linus Walleij <linus.walleij at linaro.org>
> Subject: [PATCH] gemini: Add hdparm setting
> 
> This uses "hdparm" (if present) to get the harddisk into low power mode on
> NAS set-ups.
> 
> Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
> ---
>  .../linux/gemini/base-files/etc/board.d/03_hdparm | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>  create mode 100755 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 100755
> index 000000000000..68d76f0acdf8
> --- /dev/null
> +++ b/target/linux/gemini/base-files/etc/board.d/03_hdparm
> @@ -0,0 +1,15 @@
> +#!/bin/sh

board.d files are not executable anymore. Please remove shebang and execute bit.

Please add an SPDX license identifier instead.

> +# Spin down drives after one minute if inactive
> +
> +which hdparm > /dev/null

I think using which has been discouraged lately in favor of command -v ...

> +if [ ! $? -eq 0 ] ; then

"$?" != 0 ?

> +	exit 0
> +fi
> +
> +DISKS=`find /dev/sd[a-z] 2>/dev/null`

Please use $() instead of backticks.

Best

Adrian

> +for DISK in $DISKS
> +do
> +	if [ -b $DISK ] ; then
> +		hdparm -S 12 /dev/sda > /dev/null
> +	fi
> +done
> --
> 2.31.1
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20210705/bcc25e27/attachment.sig>


More information about the openwrt-devel mailing list