LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 09-28-2011, 09:46 PM   #1
Bfkhiya
LQ Newbie
 
Registered: Sep 2011
Posts: 10

Rep: Reputation: Disabled
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:


#!/bin/sh

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?

Thanks,
Khiya
 
Old 09-28-2011, 10:09 PM   #2
corp769
Guru
 
Registered: Apr 2005
Posts: 5,814

Rep: Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001
Hello,

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.
Code:
ls -al /etc/network/if-up.d/*
Cheers,

Josh
 
Old 09-28-2011, 10:52 PM   #3
Bfkhiya
LQ Newbie
 
Registered: Sep 2011
Posts: 10

Original Poster
Rep: Reputation: Disabled
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?:

Code:
$ 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/ifupdown.sh
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.

Best,
Khiya
 
Old 09-28-2011, 11:13 PM   #4
corp769
Guru
 
Registered: Apr 2005
Posts: 5,814

Rep: Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001
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.
 
Old 09-29-2011, 06:37 PM   #5
Bfkhiya
LQ Newbie
 
Registered: Sep 2011
Posts: 10

Original Poster
Rep: Reputation: Disabled
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.
 
  


Reply

Tags
script, shell, ubuntu


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Startup scripts don't get executed gusblake Fedora 2 06-23-2010 05:50 PM
how do /rc.d scripts get executed? mfoley Slackware 6 10-04-2009 12:10 PM
Kill scripts not being executed upon reboot druidmatrix Red Hat 9 02-17-2009 09:03 PM
LXer: Ubuntu by Dummies: switching between saved network settings LXer Syndicated Linux News 0 10-17-2007 06:41 AM
RHEL3: init scripts aren't executed dabang Red Hat 2 01-04-2007 08:54 AM


All times are GMT -5. The time now is 06:22 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration