hd-idle icon indicating copy to clipboard operation
hd-idle copied to clipboard

Add possibility to execute scripts after spinup or spindown

Open Sab44 opened this issue 5 months ago • 0 comments

This is a feature I personally required. What I use it for:

  • send notification to Home Assistant on spin-up and on spin-down so I can track HDD state in Home Assistant
  • execute df command after spin-up and send output to Home Assistant - allows me to track free space left on disk (alternatives like periodically executing the df command via ssh would oftentimes spin-up the drive unnecessarily).

I considered building a service to observe the system journal for hd-idle's logs, but this solution proved much nicer.

Important note: I'm not a security expert, but I imagine there's a potential security risk, as hd-idle runs as root and will therefore execute the given scripts as root. So I can understand if there are concerns here. If you think this feature is nice to have, maybe someone with more security expertise can review and potentially advise on how to secure this. Otherwise, feel free to close this PR, all good. Just wanted to offer to contribute back the work I put in.

Thanks for this great tool!

Sab44 avatar Sep 27 '25 05:09 Sab44