Results 1 to 4 of 4

Thread: test if eth0 is active

  1. #1
    Join Date
    Jan 2009
    Location
    Flanders
    Beans
    Hidden!

    test if eth0 is active

    Is there a way to test if the eth0 connection is active? I would like to use this in a script.

    I know it's possible to do with
    Code:
    $ ethtool eth0 | grep Link
    But I don't like this command because it has to be executed as super user. And I want my script to be executed as a normal user.

  2. #2
    Join Date
    Mar 2007
    Location
    Wenatchee, WA
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: test if eth0 is active

    'ifconfig eth0' ?

    Though you might want configure your script to check that it has an IP address assigned to it as well that it exists.

  3. #3
    Join Date
    Nov 2006
    Location
    Germany
    Beans
    852
    Distro
    Kubuntu 10.10 Maverick Meerkat

    Re: test if eth0 is active

    To check if it has an ip-address, use:
    Code:
     ifconfig eth0 | grep -i 'inet address'
    watch out where the huskies go
    and don't you eat that yellow snow (Zappa)

    http://www.youtube.com/watch?v=YGZ5isu23ow
    http://www.youtube.com/watch?v=xPsnLUaXyxE

  4. #4
    Join Date
    Jan 2009
    Location
    Flanders
    Beans
    Hidden!

    Re: test if eth0 is active

    Thanks, could now make a script to autologin on the internet via a web page (together with greasemonkey)
    Attached Files Attached Files

Tags for this Thread

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
  •