Results 1 to 3 of 3

Thread: Keeping my Internet Connection alive

  1. #1
    Join Date
    Dec 2004
    Location
    Israel
    Beans
    17
    Distro
    Kubuntu Breezy 5.10

    Keeping my Internet Connection alive

    Hello

    As you know, I wrote a scripts that dials to my ISP and opened a PPTP tunnel to my cables company.
    After running the script, i have 'ppp0' connection in my ifconfig, that contains my real ip address.

    The problem is that sometimes this internet connection disappears only god knows why, and i need to run my script again to make it alive again.

    How can i make this automatic ? I want that my linux will run the script for me every time my internet connection dies, without my interruption.
    Note: My script need to be runned with root privileges.

    Thanks, Alexander

  2. #2
    Join Date
    Oct 2004
    Location
    Cupertino, CA
    Beans
    5,092
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Keeping my Internet Connection alive

    You'd want it running as a daemon, sort of like an init script. Use an existing Init script as a reference: /etc/init.d/cupsys is a very clean one.


    Let's call it

    /usr/local/bin/internetd

    You'd also want a /etc/init.d/internetd, which is modeled off cupsys to start/stop internetd.

    Your internet keepalive script should be an infinite loop with the following logic:

    1. Check for internet access. Do so by pinging a well-known site, or by using regular expressions to parse ifconfig output. (Doesn't the first option sound SO much easier?)
    A: YES: Do nothing
    B: NO: Initiate an internet connection.
    2. Sleep for x amount of time. Use the sleep or usleep command to do so. This is to prevent the script from going TOO quickly and slowing down the rest of your system! 1 second should be appropriate.
    Quote Originally Posted by tuxradar
    Linux's audio architecture is more like the layers of the Earth's crust than the network model, with lower levels occasionally erupting on to the surface, causing confusion and distress, and upper layers moving to displace the underlying technology that was originally hidden

  3. #3
    Join Date
    Dec 2004
    Location
    Israel
    Beans
    17
    Distro
    Kubuntu Breezy 5.10

    Re: Keeping my Internet Connection alive

    Thanks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •