Stux
MVP
- Joined
- Jun 2, 2016
- Messages
- 4,419
I'm in the process of moving my scripts to my pool. It means that my CRON command has to be something like ...
Code:./../mnt/<pool>/FreeNAS/Scripts/blah.sh
I've also included a 'cd' at the top of my scripts to change the 'active' directory to that scripts directory - then the tmp and Data directories hang off the script directory.
However, that 'cd' means that it throws an error if I execute the script from the CLI. I got around that by wrapping the 'cd' command in an IF statement that checks if that directory (../mnt/<pool>/FreeNAS/Scripts) exists.
Further fun and games (including some comments on some posts over the last few pages) ... the script that reports the GPTID didn't like one of the geom ...
glabel: No such geom: ada1p2.
That was because there wasn't a 2nd partition for that particular drive (the p2 part). Changing it to P1 (ie ada1p1) resulted in no error.
I fudged a test to see if I should be using adaXp1 or adaXp2 ... but it isn't very generic. Is there a way to tell if the 2nd partition exists?
Finally, SSDs do report temps via SMART ... but the grep part (grep "Temperature_Celsius") might not use those exact letters. For example, my Samsung SSD reports temp as something like "Air Flow Temp" ... so you need to modify the grep part.
Second finally, is there a way of being able to tell a SSD from a HDD?
Edit: See here ... http://unix.stackexchange.com/quest...-disk-is-compact-flash-or-standard-hard-drive
Code:Rotational=`smartctl -a /dev/adaX | grep "Rotation" | awk '{print $3}'` if [ $Rotational == "Solid" ] then isSSD=1 isHDD=0 else isSSD=0 isHDD=1 fi
Instead of using a relative path (one which starts with ./ or ../) use an absolute path (one that starts with a /)
/mnt/<pool>/FreeNAS/Scripts/blah.sh
Same for the cd.