From mboxrd@z Thu Jan 1 00:00:00 1970 From: Walt H Date: Thu, 30 Dec 2004 16:28:05 +0000 Subject: Help with udev dev.d and net script Message-Id: <41D42C95.20206@lorettotel.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org Hello, I've been struggling to try to get a shell script executed when my system starts it network interfaces. I'm running kernel 2.6.10 with udev-050 and the 20040923 hotplug scripts on a Gentoo based system. I've got 2 Intel e100 network interfaces (using kernel modules), one of which connects to my DSL modem and gets its IP address dynamically via DHCP. My ISP can be very slow in giving an IP address (30-45 seconds), which causes a problem with my firewall script, which is automatically generated by fwbuilder. What I've been trying to do, is execute a script under /etc/dev.d/ for my eth1 interface, which sleeps until the interface gets an IP address, and then runs the firewall script. Unfortunately, the firewall script needs an IP address for the interface to operate correctly, and without one, no traffic in or out will pass through this box. I've tried putting the script in /etc/dev.d/eth1/ /etc/dev.d/net/eth1 etc... but it never gets executed. I could brute force the issue by modifying a hotplug script or init script, but don't want to have to do this after each upgrade and the udev /etc/dev.d stuff seemed appropriate. What am I doing wrong? My init scripts can be executed in parallel, which is what contributes to this problem I believe, as additional startup scripts may be executed before the interface is fully brought up. I could stop that I suppose, but I want to know why the dev.d stuff isn't working first I guess :) Thanks in advance, -Walt ### /etc/dev.d/eth1/startfirewall.dev script follows: #!/bin/bash LOGFILE=/tmp/eth1-udev.log echo `date` ": Starting fwbuilder firewall script...." >> $LOGFILE NETUP=0 while [ $NETUP -eq 0 ]; do IP=`/sbin/ip -4 addr show dev eth1 | tail -n1` &> /dev/null if ! test -z "$IP"; then NETUP=1 echo `date` ": eth1 up with IP: $IP" >> $LOGFILE else echo `date` ": eth1 not up yet. Will retry in 10s..." >> $LOGFILE sleep 10 fi done echo `date` ": Activating firewall script now..." >> $LOGFILE /etc/fwbuilder/Holman\ Network.fw &> /dev/null ------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel