0

I'm mounting several drives in a script. Each one is sometimes unavailable, because the PC it's on is turned off, for instance. However, mount_smbfs takes a long time to fail (around 75 seconds), even with the "-o soft" option. Is there a way to speed this up?

Thinking about it, I guess a workaround would be to first ping the machine, and only attempt the mount if that succeeds. Is there an even better way?

Steve Bennett
  • 5,750
  • 12
  • 47
  • 59

1 Answers1

0

This works as a workaround:

ping -q -c 1 -t 2 ${HOST} > /dev/null;
if [ $? -ne 0 ]; then
   echo "${HOST} is down."
else
   mount_smbfs ...
fi

Where -t 2 is a 2 second timeout.

Steve Bennett
  • 5,750
  • 12
  • 47
  • 59