Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripting feature within hd-idle #49

Closed
wmd1942 opened this issue Mar 29, 2021 · 2 comments
Closed

Scripting feature within hd-idle #49

wmd1942 opened this issue Mar 29, 2021 · 2 comments
Labels
question Further information is requested

Comments

@wmd1942
Copy link

wmd1942 commented Mar 29, 2021

I have a usbrelay module to control the cooling fan through a simple script command. Is there any way to provide the scripting capability so the scripts could be invoked when disk spin down/up?

@adelolmo
Copy link
Owner

Short answer: no.
Long answer: You could figure a way to pull /var/log/syslog for sdx spindown entries.

@adelolmo adelolmo added the question Further information is requested label Apr 2, 2021
@wmd1942 wmd1942 closed this as completed Apr 2, 2021
@wmd1942
Copy link
Author

wmd1942 commented Apr 2, 2021

I wrote a bash script to pull hd-idle entry from syslog every minute. It works well. Thanks for the suggestion.

#!/usr/bin/bash

while true; do
hd_state=$(cat /var/log/syslog | grep "hd-idle" | tail -n 1 | awk -F ":" '{ print $4 }' | awk -F " " '{ print $2 }')
if [[ $hd_state = "spindown" ]]
then
/root/cooling-fan-off.sh
else
/root/cooling-fan-on.sh
fi
sleep 60s # run every 1 min
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants