Setting a custom timeout to nmblookup
Posted
by
C2H5OH
on Server Fault
See other posts from Server Fault
or by C2H5OH
Published on 2013-06-26T13:51:48Z
Indexed on
2013/06/29
16:23 UTC
Read the original article
Hit count: 625
As part of a batch script, I have the following command:
hostname=$(nmblookup -A $ip_address | awk '$2 == "<20>" {print $1}')
Which works fine from a functinality perspective, even for unresolved hosts.
The problem is that when the IP address is not reachable or the remote machine does not respond to the SMB request, the command takes about ten seconds to complete. Therefore, the question is simple: is there a way to lower the elapsed time in such cases? Or, in other words, is there a way to set a custom timeout for the nmblookup
command?
NOTE: I'm interested in solutions that do not make use of SIGALRM
or similar mechanisms; if they exist. The nmblookup
version is 3.6.3
from Ubuntu 12.04 LTS.
© Server Fault or respective owner