This could sound trivial, but in a book (guess which one) I found a sample script that, before mounting a USB stick, was poking the drive using a command like the following:
Now, I thought that redirecting stdout to a whole drive was a bad idea, but after having a look at the very simple code of true(1) I understand it does nothing with its stdout so nothing is really happening. Therefore, as I understand the above, the trick is to "simulate" a write to the disk with nothing to write just to wait that the device is ready, If that is true, than the initial sleep(1) should not be required, since the redirection will "wait" until the drive is ready.
Moreover, is it possible to poke the drive using another command like
or in this case the command returns immediately because the node exists?
Code:
sleep 2
/bin/true > /dev/da1
Now, I thought that redirecting stdout to a whole drive was a bad idea, but after having a look at the very simple code of true(1) I understand it does nothing with its stdout so nothing is really happening. Therefore, as I understand the above, the trick is to "simulate" a write to the disk with nothing to write just to wait that the device is ready, If that is true, than the initial sleep(1) should not be required, since the redirection will "wait" until the drive is ready.
Moreover, is it possible to poke the drive using another command like
Code:
test -s /dev/da1