HDD Spindown Timer

HDD Spindown Timer 2.2.0

Say Heading

Dabbler
Joined
Dec 18, 2023
Messages
20
Thanks Davvo, your detailed info is highly appreciated.
I wasn't aware that I already was in the boot-pool, so I've started over. But so far without success. I'm suspecting that I am making something wrong in the syntax of the command related to the Init Task, either path or mismatching arguments.

A scripts folder is created on the boot-pool, spindown_timer.sh copied via your link, and
Code:
chmod +x spindown_timer.sh
applied.

Bildschirmfoto 2023-12-20 um 10.43.20.png

The system dataset is relocated to the boot-pool:

Bildschirmfoto 2023-12-20 um 10.44.53.png


The Init/Shutdown script command was tried with various path tryouts.
So far I used

Code:
boot-pool/scripts/spindown_timer.sh (...)
/boot-pool/scripts/spindown_timer.sh (...)
scripts/spindown_timer.sh (...)
/scripts/spindown_timer.sh (...)


always with the same arguments that differ from the longer defaults only for the purpose of testing.
My intention was to ignore the boot USB (da0) for which the disk settings in the GUI are vanilla, to spindown the HDDs ada0/ada1/ada2 (settings as instructed on github) and shutdown.

Bildschirmfoto 2023-12-20 um 10.45.54.png


Is my fault already visible here somewhere?
 

Davvo

MVP
Joined
Jul 12, 2022
Messages
3,222
Is my fault already visible here somewhere?
Use ./scripts/spindown_timer.sh -t 700 -p 300 -i da0 -s 1200: emphasis on the dot before the first /.
 

Say Heading

Dabbler
Joined
Dec 18, 2023
Messages
20
Use ./scripts/spindown_timer.sh -t 700 -p 300 -i da0 -s 1200: emphasis on the dot before the first /.
Cheers, will give it a try right away. Just for confirmation within the arguments (typo) ... oh wait, just as I'm typing I notice, that my screen display of your message shows "-è 300", but my reply quotes "-p 300". So I'll go for -p...
 

Say Heading

Dabbler
Joined
Dec 18, 2023
Messages
20
A bit stumped but struggling:
As nothing happened, no spin down nor shutdown, I decided to try it with a new downloaded copy of spindown_timer.sh, this time back within "tank" on HDD, assuming that the script would be loaded to RAM and survive a disk spin down. No operational success, but this time
Code:
ps -aux | grep "spindown_timer.sh"

offered a result what it didn't when using the version on my boot-pool.
Replaced the spindown_timer.sh on the boot pool with a fresh copy, chmod-ed et voila:

Bildschirmfoto 2023-12-20 um 19.44.22.png


But even now there was no spindown/shutdown.
And to my disappointment when I rebooted the server today for further tests I found out, that the above command doesn't give a result anymore.
I'm running out of ideas right now.
 

Davvo

MVP
Joined
Jul 12, 2022
Messages
3,222
What is the output of ./scripts/spindown_timer.sh -v -d -t 700 -p 300 -i da0 -s 1200?
The script should spindown the drives if they receive no I/O for a given (t) amount of time (in seconds).
 

Say Heading

Dabbler
Joined
Dec 18, 2023
Messages
20
Where will I find the output? Just preparing the command...
 

Say Heading

Dabbler
Joined
Dec 18, 2023
Messages
20
Sorry, I'm lost. As I said: noob... I could offer webUI or terminal, but don't know where to find the verbose log.
 

Davvo

MVP
Joined
Jul 12, 2022
Messages
3,222
@Say Heading go SSH and run the command, it will tell you something on screen.
@ngandrass incidentally I think there is an issue with the code:
Code:
root@truenas[~/scripts]# ./spindown_timer.sh -v -d -u zpool -t 700 -i boot-pool
./spindown_timer.sh: 1: Syntax error: "&" unexpected
./spindown_timer.sh: 1: Syntax error: Error in command substitution
 

Say Heading

Dabbler
Joined
Dec 18, 2023
Messages
20
Ah, okay! The output is:
Code:
root@truenas[~]# ./scripts/spindown_timer.sh -v -d -t 700 -p 300 -i da0 -s 1200
./scripts/spindown_timer.sh: 1: Syntax error: "&" unexpected
./scripts/spindown_timer.sh: 1: Syntax error: Error in command substitution
 

Davvo

MVP
Joined
Jul 12, 2022
Messages
3,222
Either we are making an obvious mistake or there is an error in the code (there was an update recently, might have broken something).
Let's wait for ngandrass reply.
 

Say Heading

Dabbler
Joined
Dec 18, 2023
Messages
20
Are you using an older version of the script? If that works for you it might be worth trying it on my side...
 

Davvo

MVP
Joined
Jul 12, 2022
Messages
3,222
I'm not actually spinning my drives down, tried running the script since you were having issues.
 

Say Heading

Dabbler
Joined
Dec 18, 2023
Messages
20
Interesting finding:
Installed script version 2.1.0 (2023-02-19) and got this result:

Bildschirmfoto 2023-12-21 um 19.30.02.png


Applying it as Init shutdown task:

Bildschirmfoto 2023-12-21 um 19.40.09.png


This one spins my HDDs down and shuts down the server as intended. Yes!!!
 

Say Heading

Dabbler
Joined
Dec 18, 2023
Messages
20
...another observation to make the script work at different locations:
In the webGUI>Tasks>Init/Shutdown Script>Command
for the script located on the pool

"/mnt/tank/scripts/spindown_timer (...)"

is sufficient,
but if the script is located on the boot-pool a full path is required to make it work, like

"/root/scripts/spindown_timer (...)",

at least for me...
 

ngandrass

Explorer
Joined
Jun 26, 2019
Messages
68
@Say Heading go SSH and run the command, it will tell you something on screen.
@ngandrass incidentally I think there is an issue with the code:
Code:
root@truenas[~/scripts]# ./spindown_timer.sh -v -d -u zpool -t 700 -i boot-pool
./spindown_timer.sh: 1: Syntax error: "&" unexpected
./spindown_timer.sh: 1: Syntax error: Error in command substitution

Hey there,

please excuse my late reply. I just found this message by accident. Please report all issues to the issue tracker on GitHub: https://github.com/ngandrass/truenas-spindown-timer/. This way I get a proper notification :wink:

To me, the error looks like your spindown_timer.sh file is corrupt. Please verify the SHA256 cheksum of the file by executing the following command:
Code:
sha256sum spindown_timer.sh


It must match 6c00ed442a651ad2f827e5de8b8a075a317f312189762ed69c81fddff02669ea. If you get another checksum, replace the file on your NAS with the proper version from the repository: https://github.com/ngandrass/truenas-spindown-timer/blob/master/spindown_timer.sh
 

Davvo

MVP
Joined
Jul 12, 2022
Messages
3,222
To me, the error looks like your spindown_timer.sh file is corrupt. Please verify the SHA256 cheksum of the file by executing the following command: sha256sum spindown_timer.sh

It must match 6c00ed442a651ad2f827e5de8b8a075a317f312189762ed69c81fddff02669ea. If you get another checksum, replace the file on your NAS with the proper version from the repository: https://github.com/ngandrass/truenas-spindown-timer/blob/master/spindown_timer.sh
Just got a 166e7aaf3892804dd711c73db2175c2a0fe6dd5c40228be9e3226a15b5e2ab0e checksum with a fresh fetch https://github.com/ngandrass/truenas-spindown-timer/blob/master/spindown_timer.sh.

Manually downloading the script from the link instead gives me a correct cheksum instead, and it works fine.
 

ngandrass

Explorer
Joined
Jun 26, 2019
Messages
68
Just got a 166e7aaf3892804dd711c73db2175c2a0fe6dd5c40228be9e3226a15b5e2ab0e checksum with a fresh fetch https://github.com/ngandrass/truenas-spindown-timer/blob/master/spindown_timer.sh.

Manually downloading the script from the link instead gives me a correct cheksum instead.

The posted link is not a direct link to the raw file but a GitHub page instead! Downloading this via console results in wrong file contents!

Either use the download button on the webpage or use the link to the raw file: https://raw.githubusercontent.com/ngandrass/truenas-spindown-timer/master/spindown_timer.sh

Downloading the correct file directly to your NAS:
Code:
fetch https://raw.githubusercontent.com/ngandrass/truenas-spindown-timer/master/spindown_timer.sh
or
Code:
wget https://raw.githubusercontent.com/ngandrass/truenas-spindown-timer/master/spindown_timer.sh


But the more interesting question is: Does the correct file solves your issue? :)
 

Davvo

MVP
Joined
Jul 12, 2022
Messages
3,222
The posted link is not a direct link to the raw file but a GitHub page instead! Downloading this via console results in wrong file contents!
I'm so dumb.

But the more interesting question is: Does the correct file solves your issue? :)
It does, thank you.
 
Last edited:

Say Heading

Dabbler
Joined
Dec 18, 2023
Messages
20
Wasn't able to keep up with your conversation speed :) Looks like you got it sorted out, so I'll give 2.2.0 another try tomorrow.
 
Top