Ef57uiKnN6
Dabbler
- Joined
- Mar 25, 2012
- Messages
- 28
Just noticed the by FreeNAS 9.1.0 introduced 'Init/Shutdown Script' option which makes the addition of rc files unnecessary.
There is no one correct way to install the script. But the INSTALL file within the tarball (0.3 recently updated with updated INSTALL file) shows how one might install it properly.How can I check if the script has been installed correctly and working?
[root@freenas2] ~# pgrep -f hdd_spindown.sh 5883 [root@freenas2] ~# ps 5883 PID TT STAT TIME COMMAND 5883 v0- I 0:00.74 /bin/bash /data/bin/hdd_spindown.sh -s [root@freenas2] ~#
[root@freenas2] /data/bin# grep hdd_spindown /var/log/messages Jan 14 03:20:39 freenas2 hdd_spindown[5887]: Configured HDD standby times will be refreshed after every '12' checks Jan 14 03:20:39 freenas2 hdd_spindown[5889]: Initial check does not spin down any drive Jan 14 03:20:40 freenas2 hdd_spindown[5917]: Drive da0 is configured to be spun down after '7200' seconds of inactivity Jan 14 03:20:40 freenas2 hdd_spindown[5919]: Drive da1 is configured to be spun down after '7200' seconds of inactivity Jan 14 03:20:40 freenas2 hdd_spindown[5923]: Drive da2 is configured to be spun down after '7200' seconds of inactivity Jan 14 03:20:40 freenas2 hdd_spindown[5927]: Drive ada0 is configured to be spun down after '7200' seconds of inactivity Jan 14 03:20:40 freenas2 hdd_spindown[5931]: Drive ada1 is configured to be spun down after '7200' seconds of inactivity Jan 14 03:20:40 freenas2 hdd_spindown[5935]: Drive ada2 is configured to be spun down after '7200' seconds of inactivity Jan 14 03:20:40 freenas2 hdd_spindown[5936]: Drive ada3 is configured to be spun down after '7200' seconds of inactivity Jan 14 03:20:40 freenas2 hdd_spindown[5938]: Drive ada4 is configured to be spun down after '7200' seconds of inactivity Jan 14 03:20:40 freenas2 hdd_spindown[5939]: Drive ada5 is configured to be spun down after '7200' seconds of inactivity Jan 14 03:20:40 freenas2 hdd_spindown[5943]: Drive ada6 is configured to be spun down after '7200' seconds of inactivity Jan 14 03:20:40 freenas2 hdd_spindown[5944]: Drive ada7 is configured to be spun down after '7200' seconds of inactivity Jan 14 03:20:40 freenas2 hdd_spindown[6060]: Sleeping '7200' seconds till next check. '11' checks left to next update of HDD standby times. Jan 14 05:20:40 freenas2 hdd_spindown[10083]: Spinning down drive by command 'camcontrol stop ada7' failed Jan 14 05:20:40 freenas2 hdd_spindown[10086]: Spinning down drive by command 'atacontrol spindown ada7' failed Jan 14 05:20:40 freenas2 hdd_spindown[10089]: Spinning down drive by command 'ataidle -s /dev/ada7' failed Jan 14 05:20:40 freenas2 hdd_spindown[10092]: Drive 'ada7' successfully spun down by command '/usr/local/sbin/ataidle -s /dev/ada7'
[root@freenas2] ~# /data/bin/hdd_spindown.sh 1389727828 0info Configured HDD standby times will be refreshed after every '12' checks 1389727828 0info Initial check does not spin down any drive 1389727829 0info Drive da0 is configured to be spun down after '7200' seconds of inactivity 1389727829 0info Drive da1 is configured to be spun down after '7200' seconds of inactivity 1389727829 0info Drive da2 is configured to be spun down after '7200' seconds of inactivity 1389727829 0info Drive ada0 is configured to be spun down after '7200' seconds of inactivity 1389727829 0info Drive ada1 is configured to be spun down after '7200' seconds of inactivity 1389727829 0info Drive ada2 is configured to be spun down after '7200' seconds of inactivity 1389727829 0info Drive ada3 is configured to be spun down after '7200' seconds of inactivity 1389727829 0info Drive ada4 is configured to be spun down after '7200' seconds of inactivity 1389727829 0info Drive ada5 is configured to be spun down after '7200' seconds of inactivity 1389727829 0info Drive ada6 is configured to be spun down after '7200' seconds of inactivity 1389727829 0info Drive ada7 is configured to be spun down after '7200' seconds of inactivity 1389727829 0info Sleeping '7200' seconds till next check. '11' checks left to next update of HDD standby times. ^C [root@freenas2] ~#
I still have a problem with the HDD Caviar Green 3TB EZRX. I can not put it in IDLE. The disk is in the ZFS Pool and "Enable atime" is "Off".
--- SNIP hdd_spindown.sh --- SPINDOWN_CMD+=('this-is-a-new-command $DEV') SPINDOWN_CMD+=('/usr/local/sbin/ataidle -s $DEV') SPINDOWN_CMD+=('ataidle -s $DEV') SPINDOWN_CMD+=('/usr/local/sbin/ataidle -s /dev/$DEV') SPINDOWN_CMD+=('ataidle -s /dev/$DEV') SPINDOWN_CMD+=('atacontrol spindown $DEV') SPINDOWN_CMD+=('camcontrol stop $DEV') --- SNAP hdd_spindown.sh ---
/path/to/hdd_spindown.sh -l 0
When the shell script does not reside in one of the configured paths in your PATH variable, then you have to call the script either relatively or absolutely:After the command I got the message: hdd_spindown.sh: Command not found.
[root@freenas2] /data/bin# pwd /data/bin [root@freenas2] /data/bin# ls -1 hdd_spindown.sh hdd_spindown.sh* [root@freenas2] /data/bin# ./hdd_spindown.sh -h usage: hdd_spindown.sh [-dhist] [-l level] -d daemonize -h help -i initial spindown -l level log level -s log to syslog -t test / one-shot mode [root@freenas2] /data/bin#
[root@freenas2] ~# ls -1 /data/bin/hdd_spindown.sh /data/bin/hdd_spindown.sh* [root@freenas2] ~# /data/bin/hdd_spindown.sh -h usage: hdd_spindown.sh [-dhist] [-l level] -d daemonize -h help -i initial spindown -l level log level -s log to syslog -t test / one-shot mode [root@freenas2] ~#
Did you noticed the point and the slash before 'hdd_spindown.sh' in the example for execution when the script is located in the current working directory?:The problem is that I am in the folder where the file hdd_pindown.sh* is located and message "hdd_spindown.sh: Command not found" persists.
[root@freenas2] /data/bin# ./hdd_spindown.sh -h
hi, wanted to try out your script, tried it in test mode:
[root@nas] /???/???/???# ./hdd_spindown.sh -t
[INFO ] Initial check does not spin down any drive
[ERROR ] Got at leaset one unexpected value from database: COL1=, COL2=
[INFO ] Test/One-shot mode. Exiting.
./hdd_spindown.sh -d ./hdd_spindown.sh: line 292: export: `-d': not a valid identifier ./hdd_spindown.sh: line 292: export: `0': not a valid identifier