Re: How-to auto-start programmes when I connect to Internet?

From: Hal Burgiss (hal_at_burgiss.net)
Date: 02/14/04

  • Next message: Dirk Wendland: "Re: [PHP] Fedora FC1 + PHP 4.3.4 + phpMyAdmin 2.5.6 rc1 - Problems Resolving Included Files"
    To: fedora-list@redhat.com
    Date: Sat, 14 Feb 2004 07:55:56 -0500
    
    

    On Fri, Feb 13, 2004 at 02:01:04PM +0000, Coume - Lubox.com wrote:
    > >
    > > Sure, write a script that checks for connection, and restarts whatever
    > > you want it to.
    >
    > Could you explain a bit more? Because I do not know how to do what
    > you told me... :(

    This is the guts of a script I have called "is_up". I call this from
    other scripts to test my connection. This script just tests local
    networking, and not necessarily connectivity with my ISP (that is
    another script, more complex to ping local gateway and nameserver).

    #!/bin/bash

    IFACE=eth0

     if ! ifconfig | grep $IFACE >/dev/null 2>&1 ||\
        ! ifconfig $IFACE | grep UP >/dev/null 2>&1; then
      #if the interface is down, then the connection surely is too!
      echo "Interface is down"
      exit 1
     fi

     echo "Interface is rockin"
     exit 0

    # end of script

    Another script might look like .... (untested!!!)

    #!/bin/sh

    services="licq named postfix blah"

    if ! is_up >/dev/null; then
      # whatever means of restarting networking
      restart_interface
    fi

    if is_up >/dev/null; then

      for i in $services; do
        service $i restart
      done
      exit 0

    else
      echo "You have failed me miserably!"
      exit 1
    fi

    # end

    ########################

    The easiest thing is to run this stuff from cron every so often. You could
    also run it within a script ...

    #!/bin/sh

     while sleep 30; do
       # this is second script above
       test_connect.sh
     done

    # will run forever
    # end
    # that is all

    -- 
    Hal Burgiss
     
    -- 
    fedora-list mailing list
    fedora-list@redhat.com
    To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
    

  • Next message: Dirk Wendland: "Re: [PHP] Fedora FC1 + PHP 4.3.4 + phpMyAdmin 2.5.6 rc1 - Problems Resolving Included Files"

    Relevant Pages

    • Re: dialup solution (as seconary connection / iptables )
      ... ip-down is launched by pppd only after the PPP link no longer available ... first with MINICOM or is PAP and script not mutualy exclusive? ... do have to "make the connection first with MINICOM." ... If you use the Linux box and route the news IP address to it on each ...
      (comp.os.linux.networking)
    • Re: mysqli connections and oop
      ... need to do all processing in a script before I display a page that will ... But it will most probably NOT terminated the execution of the script. ... this means that NO lasting connection is build ... Why does it not carry the mysqli connection? ...
      (comp.lang.php)
    • Re: mysqli connections and oop
      ... And here is the script that execute this ... lose a mysqli connection upon the reload of the page? ...
      (comp.lang.php)
    • Re: Does apache stop a script mid execution ?
      ... If the user calls a time consuming script and then stops or refreshes ... How does it relate to e.g. a script performing a large mysql query? ... 2.b) how the connection is set up. ... the server stops the script execution. ...
      (comp.lang.php)
    • Re: Keeping pppd alive--how?
      ... >>wrote a script to dial up my ISP, wait 40 seconds, then start up Jay's ... Perhaps using the netstat command to do ... >options tab is an option to redial is connection is lost. ... My Linux machine is text only--no GUIs. ...
      (alt.os.linux.redhat)