Results 1 to 4 of 4

Thread: Internet Datacard gets disconnected after sometime

  1. #1

    Smile Internet Datacard gets disconnected after sometime

    Hi all,

    If i leave my laptop idle for sometime, my usb datacard connection gets disconnected. I know its a dial-up connection and if no application is accessing internet it disconnects on its own.

    The problem over here is when i click on the icon and click on activate it won't happen. So, i have to unplug the hardware and then re-insert it to make it work again.

    I went through a site, there they have mentioned a work around that is to keep a ping command always running.

    I'm fine with that, but why do we need to remove the hardware n re-insert it to make it connect to the internet again.

    I hope there must be some better work around..


    Thanks in advance... .

  2. #2
    Join Date
    Mar 2010
    Location
    Austin - Texas
    Posts
    10,140
    Blog Entries
    48

    Smile Re: Internet Datacard gets disconnected after sometime

    I wrote a keep alive bash script I called gping you could run in a terminal session to keep your session running. It does an (adjustable) ping every 5 minutes to an (optional) Google and would exit if it failed to ping the site. Copy and past this text into a text editor:

    Code:
    #!/bin/bash
    
    #: Title       : gping
    #: Date Created: Sat May 21 08:59:04 CDT 2011
    #: Last Edit   : Sat May 21 08:59:04 CDT 2011
    #: Author      : J. McDaniel
    #: Version     : 1.00
    #: Description : Ping a Site on a specified Interval
    #: Options     : None
    
    # What Do you want to Ping?
    Ping_What="www.google.com"
    
    # How Many Times to Ping Site
    Num_Pings=3
    
    # How Long To Wait in seconds Between Pings
    Wait_Time=300
    
    while true  ; do
      ping -c $(( Num_Pings )) $Ping_What
      Exit_Code=$?
      if [ $(( Exit_Code )) -ge 1 ] ; then
        echo "Could Not Ping: $Ping_What" 
        exit $(( Exit_Code ))
      else
       sleep $(( Wait_Time ))
      fi
    done
    
    exit 0
    # End Of Script
    Save the text into the folder ~/bin (/home/yourname/bin) as the text file gping. Then run the following command on it to make it executable:

    chmod +x ~/bin/gping

    To use gping, just open up a terminal session and run the command:

    Code:
    gping
    Every five minutes, you would see something like this in your terminal session:

    Code:
    PING www.l.google.com (74.125.227.49) 56(84) bytes of data.
    64 bytes from 74.125.227.49: icmp_req=1 ttl=53 time=15.2 ms
    64 bytes from 74.125.227.49: icmp_req=2 ttl=53 time=14.0 ms
    64 bytes from 74.125.227.49: icmp_req=3 ttl=53 time=27.2 ms
    
    --- www.l.google.com ping statistics ---
    3 packets transmitted, 3 received, 0% packet loss, time 2002ms
    rtt min/avg/max/mdev = 14.064/18.881/27.291/5.967 ms
    Hope you find this helpful...

    Thank You,
    My Blog: https://forums.opensuse.org/blogs/jdmcdaniel3/

    Software efficiency halves every 18 months, thus compensating for Moore's Law

    Its James again from Austin, Texas

  3. #3

    Default Re: Internet Datacard gets disconnected after sometime

    Thanks James it does help.. thanks a ton..... well i like the last line

    Remember that little in Life is certain, including any advice you may get from me, you poor soul, but at least I am trying to help.

    Its James again from Austin Texas - To err is human... to really foul up requires the root password!

  4. #4
    Join Date
    Mar 2010
    Location
    Austin - Texas
    Posts
    10,140
    Blog Entries
    48

    Smile Re: Internet Datacard gets disconnected after sometime

    Thanks James it does help.. thanks a ton..... well i like the last line
    You are very welcome lavi0007 for the help. Please let us know if you require any other assistance and thanks for using openSUSE and the openSUSE forum.

    Thank You,
    My Blog: https://forums.opensuse.org/blogs/jdmcdaniel3/

    Software efficiency halves every 18 months, thus compensating for Moore's Law

    Its James again from Austin, Texas

Posting Permissions

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