I'm writing a shell script that brings up an Ethernet interface (configured for DHCP) to determine whether it's connected to a network. If it isn't, I'd like to be able to report in a timely manner (within a few seconds) that there's no connection. Unfortunately, in the absence of a connection, ifup seems to wait several minutes before timing out, and the man page doesn't mention a timeout parameter. Is there any way to stop it after a few seconds?
This is on Ubuntu Server 11.10; NetworkManager is not in use.