Re: Script to stop DCHP client if no ethernet cable attached
> Does anyone have a script that will detect that the ethernet port is
> not connect to a hub/switch (mii-tool detects this well) so that when
> I boot my machine when disconnected I do not have to wait for the
> DHCP client to fail.
> I currently have in /etc/network/interfaces:-
> iface eth0 inet dhcp
David,
Try adding the line
pre-up /usr/local/sbin/chkiface
under your eth0 stanza, where chkiface is a script you write, whose
return value tells whether the NIC is plugged in. See interfaces(5) for
details on "pre-up." If you need help writing the script, I'm sure
someone on debian-user could help with that as well.
Good Luck!
Jason McCarty
PS: Please CC me on replies.
Reply to: