-   Linux - Networking (
-   -   Ubuntu 10.04: Scripts saved in /etc/network/if-up.d are not being executed (

Bfkhiya 09-28-2011 08:46 PM

Ubuntu 10.04: Scripts saved in /etc/network/if-up.d are not being executed
Hello all,

I'd like the following script to execute every time my wireless network connection begins:


ifconfig | grep "Bcast" > path/to/my/textfile

I want to save this line of info from ifconfig into textfile every time my wireless begins. I saved this code in a script called "getIP" and saved that script in the /etc/network/if-up.d folder, making sure to chmod +x it.

But whenever I change wireless networks and get a new IP address, textfile does not update. HOWEVER, when I call

. getIP

from within the /etc/network/if-up.d folder, textfile updates with the proper information. Could someone please explain what more I need to do to make sure this script runs whenever my computer connects to a wireless network?


corp769 09-28-2011 09:09 PM


Are you using network manager, wicd, or running your network up manually? Also, can you post the contents of the following commands for me? I want to double check the permissions, and the ownership of the file.

ls -al /etc/network/if-up.d/*


Bfkhiya 09-28-2011 09:52 PM

Hi Josh, thanks for the quick response.

A coworker also suggested I try checking those permissions, but he couldn't deduce anything from the output. Does it tell you anything?:


$ ls -al /etc/network/if-up.d/*

-rwxr-xr-x 1 root root 892 2011-03-04 15:56 /etc/network/if-up.d/avahi-autoipd
-rwxr-xr-x 1 root root 504 2011-03-04 15:56 /etc/network/if-up.d/avahi-daemon
-rwxr-xr-x 1 root root 1203 2010-02-02 19:19 /etc/network/if-up.d/ntpdate
-rwxr-xr-x 1 root root 289 2011-09-28 20:59 /etc/network/if-up.d/getIP
-rwxr-xr-x 1 root root 480 2011-09-28 17:39 /etc/network/if-up.d/upstart
lrwxrwxrwx 1 root root 32 2011-09-23 17:59 /etc/network/if-up.d/wpasupplicant -> ../../wpa_supplicant/

My script is the 4th one down, getIP.

I've never done anything remotely related to manually managing networking in Linux before, so I assume I'm using wicd.


corp769 09-28-2011 10:13 PM

By looking at the contents, I notice other scripts in there. Do any of them run? You also need to check and make sure what connection manager you are using. You can do this by right-clicking on the icon in your task tray, and clicking on "About" or something of that nature.

Bfkhiya 09-29-2011 05:37 PM

I had assumed they were running. I'm not actually sure how to check. I had at one point tried pasting the contents of my script into the bottom of the "upstart" script, but nothing happened. I assumed that was because my code was wrong, not because "upstart" wasn't running. And I'm using NetworkManager Applet 0.8.

All times are GMT -5. The time now is 07:44 PM.