Temperature hook?

Temperature hook?

Postby mdi » Thu Jul 02, 2020 4:30 pm

Hi,
I have a NWSP2 and during summer it gets hot as much as 56-57C. I had to increase the threshold level of max temp, as it was set to 55 and the NAS started to shutdown and wake up repeatedly.

I now got a small fan pointing at it, so the temp went down about 15C, which is fine.

I was thinking it it could be possible to have a sort of SW hook connected to the HDD temp. With that I could probably define a IFTTT rule to switch my fan on and off, according to a different threshold, in order not to activate it only when necessary.

To start with something, where do I read the HDD temperature from the cmdline?
Is there a way to have a script running (every minute is fine) so I can do something with that value? If I can use the crontab from the web interface, where do I place the script?
Can I use wget or curl inside the script to make web calls?

Thanks,
MDI
mdi
Donator VIP
Donator VIP
 
Posts: 193
Joined: Tue Oct 11, 2011 1:20 pm

Re: Temperature hook?

Postby fvdw » Fri Jul 03, 2020 5:10 pm

Smartctl and hdparm command can be used to read disk temperature.
Code: Select all
smartctl -a /dev/sda | grep Temp | cut -d" " -f 2,37
Response will be something like
Temperature_Celsius 42

Code: Select all
hdparm -H /dev/sda

(The hdparm command is not supported by some disks)

I mustchave somewhere a a program that returns disk temp, I will look at that later this evening

Wget and curl can be used in shell scripts
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: Temperature hook?

Postby mdi » Fri Jul 03, 2020 10:32 pm

Thank you, in my case both work.

What would be the best place to store a script to drive the external fan via IFTTT?
I imagine i could run it via the crontab available from the web interface.

Thanks.
mdi
Donator VIP
Donator VIP
 
Posts: 193
Joined: Tue Oct 11, 2011 1:20 pm

Re: Temperature hook?

Postby fvdw » Sat Jul 04, 2020 3:02 pm

I would store it in a shared folder. If you store it in system folder it will be hone after installing a firmware upgrade.
Yes you could use cron to run your script periodically
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: Temperature hook?

Postby mdi » Sun Jul 05, 2020 10:19 am

Hi again, I implemented a script which is run every minute, but I have a doubt.
As it saves the actual temperature to a file in order to know when it goes above or below the temperature tresholds, I assume taht the disk won't ever spin down any longer.

To avoid this, the last-temperature data should be kept in memory, but this means that the script should be run as a sort of daemon.

Is that possible?
mdi
Donator VIP
Donator VIP
 
Posts: 193
Joined: Tue Oct 11, 2011 1:20 pm

Re: Temperature hook?

Postby fvdw » Sun Jul 05, 2020 7:44 pm

You could make a script that has an endless loop and use sleep command to pause it in the loop. In this case no need to use cron but start the script at boot. The firmware has a feature to run user defined scripts at boot
Ps 1 minute is very short. You can safely use 10 minutes to my opinion
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: Temperature hook?

Postby mdi » Mon Jul 06, 2020 9:40 am

Thank you fvdw, I'll consider and test this option. Thanks a lot!
mdi
Donator VIP
Donator VIP
 
Posts: 193
Joined: Tue Oct 11, 2011 1:20 pm


Return to Lacie Network Space vs2 and max version

Who is online

Users browsing this forum: No registered users and 7 guests