LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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
 
LinkBack Search this Thread
Old 01-31-2007, 03:25 AM   #1
polemon
Member
 
Registered: Jun 2005
Distribution: Fedora 18, Ubuntu 11.10, Ubuntu Server 11.10, DamnSmallLinux 3.4.4, FreeDOS 1.1, OpenBSD 5.0
Posts: 194

Rep: Reputation: 31
How to run a script after bringing up a particular network interface (ppp0)


Hi.

Whenever I establish, or reestablish a network connection - ppp0 in particular - I need to upload my IP to a certain place on a server.

Now this upload script works fine, I have set it up so it uploads the IP on boot-time.

But sometimes, my connection gets severed, and I need to upload the new IP again.

Now, how do I make my script run everytime the ppp or any other connection goes up?

Please help.

--polemon
 
Old 01-31-2007, 09:33 PM   #2
zmanea
Member
 
Registered: Sep 2003
Location: Colorado
Posts: 85

Rep: Reputation: 15
You could accomplish this a couple of ways.

1. You could run a cron job that runs the script every 5 minutes.

2. You could call the script from /etc/ppp/ip-up
 
Old 04-01-2007, 08:32 PM   #3
polemon
Member
 
Registered: Jun 2005
Distribution: Fedora 18, Ubuntu 11.10, Ubuntu Server 11.10, DamnSmallLinux 3.4.4, FreeDOS 1.1, OpenBSD 5.0
Posts: 194

Original Poster
Rep: Reputation: 31
I made something totally different...

But it works fine, so I'll post it here:

I made my own ppp script, ones that handles most of the preliminary work, for uploading my IP to a certain server.

this file is: /etc/ppp/ip-up-post.local

as the name implyes, it is processed _after_ the connection was established, or was tried (and failed) to be established.

That script is only interesting for my DSL connection, so I added it right after the corresponding command in /etc/sysconfig/network-scripts/ifup-ppp:
Code:
(rest of code)...

# check that xDSL connection
if [ "$TYPE" = "xDSL" ] ; then
    if [ -x /sbin/adsl-start -o -x /usr/sbin/adsl-start ] ; then
        adsl-start /etc/sysconfig/network-scripts/$CONFIG
        # run local scripts, for great justice!
        /sbin/runuser - -c /etc/ppp/ip-up-post.local
        exit $?
    else
        logger -p daemon.info -t ifup-ppp \
            $"adsl-start does not exist or is not executable for ${DEVICE}"
        exit 1
    fi
fi

...(rest of code)
works fine!
 
  


Reply

Tags
netwoking, ppp, pppoe, script


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
system locks up when bringing down bonded network interface BrianK Linux - Hardware 1 02-20-2007 10:09 PM
Bringing up interface ppp0: gets Boot stuck cleo Linux - Hardware 0 06-04-2005 12:37 PM
boot freeze a bringing up interface ppp0 vrdhananjay Linux - Software 2 10-16-2004 08:09 AM
Bringing up interface ppp0...hangs up trupillo Linux - Software 0 05-06-2004 03:12 PM
how to run script on event ppp0 interface going down ? qwijibow Linux - Networking 4 02-24-2004 06:08 AM


All times are GMT -5. The time now is 01:50 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