A few comments.
The length of time a file system on the disk (there could be more than one) has not been mounted is irrelevant. Once it's been unmounted that's it - another 10s makes no difference.
BUT - any check you make only applies when you make the check. A few milliseconds (at least) will elapse before you can run the command to power the drives down, and in that time something else (this is a multi-user system) could mount a file-system and start using it.
Hi Birdman,
i see your point and i agree. I wasnt writing a perfect solution, i was hoping i could get some help with that.
i.e i guess the perfect solution would be, check its not mounted, make it unmountable (i.e remove it from automount), check its not mounted again, then send power down command.
Then obviously reverse the process to make it possible to be woken up and remounted.
to be honest i just asumed things like this would be possible with linux, if its doable in windows i thought it would be pretty easy in linux.