Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 01-31-2007, 04:25 AM   #1
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)


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.

Old 01-31-2007, 10:33 PM   #2
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, 09:32 PM   #3
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:
(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 $?
        logger -p -t ifup-ppp \
            $"adsl-start does not exist or is not executable for ${DEVICE}"
        exit 1

...(rest of code)
works fine!


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

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 11:09 PM
Bringing up interface ppp0: gets Boot stuck cleo Linux - Hardware 0 06-04-2005 01:37 PM
boot freeze a bringing up interface ppp0 vrdhananjay Linux - Software 2 10-16-2004 09:09 AM
Bringing up interface ppp0...hangs up trupillo Linux - Software 0 05-06-2004 04:12 PM
how to run script on event ppp0 interface going down ? qwijibow Linux - Networking 4 02-24-2004 07:08 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:49 AM.

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