Waiting for command to complete in startup script, how to avoid waiting indefinetely?
Posted on 2006-06-09
As it's usually the case when we make changes things stop working as they used to... We've had to change the CF cards on our linux electronics, and these new cards no longer get mounted in the startup script (/etc/rc2.d/S99viper) as before. It seems the driver that handles this new CF card takes longer to activate and is not ready by the time it get's checked and then mounted. However I can mount the CF manually without any trouble once the system has finished booting.
This is what the startup script does to the CF:
#Check compact flash
fsck -y /dev/hda1
# Mount CF
I would like the script to test if the command fsck has been succesful and if not wait till it is. Is this script correct?
while ! fsck -y /dev/hda1
However it seems a bit dangerous, couldn't it get blocked for ever?, is there a simple way to put a timeout of some sort or to avoid the startup script to be stuck in this test indefinetely?
Thanks for your help!