Your forum username:
Do you already have an account?
Forgot your password?
  • Log in or Sign up


    Welcome to Sky User - The Unofficial Support Forum for everything Sky! - Proudly helping over 65k members.


    Advertisement

    Results 1 to 4 of 4
    Like Tree1Likes
    • 1 Post By ant_thomas

    Bash script to check connection speed - F@ST2504n

    This is a discussion on Bash script to check connection speed - F@ST2504n within the Sky Router forums, part of the Sky Broadband help category; Not sure if this is any use to anyone but I thought I'd post it up here for people to ...

    1. #1
      ant_thomas's Avatar
      ant_thomas is offline Sky User Member
      Exchange: Blackfriars
      Broadband ISP: Sky Broadband Unlimited
      Router: Sagem F@ST 2504n
      Sky TV:
      Join Date
      Jul 2007
      Location
      Manchester
      Posts
      12
      Thanks
      0
      Thanked 3 Times in 2 Posts

      Bash script to check connection speed - F@ST2504n

      Not sure if this is any use to anyone but I thought I'd post it up here for people to use as they wish.

      I have a problem with my connection and it drops out multiple times a day, before I lodge a complaint and get Sky to get BTOpenreach to fix the line issue I wanted to log when the downtime was, how often etc etc.

      One main issue is that when the connection drops out the router often syncs at a much slower speed. Included in the script is a line that if the router syncs at a speed below what I have deemed suitable it tells router to reboot. It will do this unless the sync speed is what it should be.

      In my case my sync speeds seems to max around 8500kbps so I've set the lower limit at 7000kbps. If it syncs lower it tends to be around 4500kbps.

      This is a script that I run on a Linux machine, I have a cronjob setup to run it every minute. The reason I picked every minute was that when the connection drops out it can often be back up within a couple of minutes so I need an update frequency that would take this into account and log the downtime.

      Here's the script I've been using....

      Code:
      #!/bin/sh
      #
      LOGIN="admin"
      PW="sky"
      
      mkdir /tmp/router
      cd /tmp/router
      wget -q --user=$LOGIN --password=$PW  http://192.168.1.1/sky_system.html
      sed -n 161p sky_system.html >> down.txt
      grep -o '[0-9][0-9][0-9][0-9]' down.txt >> result.txt
      rm sky_system.html down.txt
      SPEED=$(cat result.txt)
      if [ "$SPEED" -le 7000 ]; then
       echo `date "+%y/%m/%d %H:%M:%S"` "- $SPEED kbps ... rebooting router" >> /share/routerstat.txt
       curl -s http://admin:sky@192.168.1.1/sky_rebootinfo.html >> reboot.html ;
      else
       echo `date "+%y/%m/%d %H:%M:%S"` "- $SPEED kbps" >> /share/routerstat.txt
      fi
      rm *
      rm -rf /tmp/router
      
      exit 0
      Probably a number of better ways to do this, but that's what I've got.

      I've also made the log accessible via a webpage. This gives output like this....

      Code:
      12/10/08 11:41:02 - 8550 kbps
      12/10/08 11:40:01 - 8550 kbps
      12/10/08 11:39:01 - 8550 kbps
      12/10/08 11:38:02 - 8550 kbps
      12/10/08 11:37:02 - kbps
      12/10/08 11:36:01 - 4630 kbps ... rebooting router
      12/10/08 11:35:02 - kbps
      12/10/08 11:34:01 - 4598 kbps ... rebooting router
      12/10/08 11:33:01 - kbps
      12/10/08 11:32:02 - 4663 kbps ... rebooting router
      12/10/08 11:31:01 - kbps
      12/10/08 11:30:01 - 4576 kbps ... rebooting router
      12/10/08 11:29:02 - kbps
      12/10/08 11:28:01 - 4558 kbps ... rebooting router
      12/10/08 11:27:01 - kbps
      12/10/08 11:26:02 - 4502 kbps ... rebooting router
      12/10/08 11:25:01 - kbps
      12/10/08 11:24:01 - 4402 kbps ... rebooting router
      12/10/08 11:23:01 - kbps
      12/10/08 11:22:01 - 8762 kbps
      12/10/08 11:21:02 - 8762 kbps
      12/10/08 11:20:01 - 8762 kbps
      12/10/08 11:19:01 - 8762 kbps
      12/10/08 11:18:02 - 8762 kbps
      12/10/08 11:17:01 - 8762 kbps
      12/10/08 11:16:01 - 8762 kbps
      The basic code for this is....

      Code:
      <?php
      
      {
      $lines = $_GET['lines'];
      if ($lines == null){
        $linestring = 25;}
      
        else {$linestring = $lines;}
      }
      
      $output = "";
      $linesout = array_slice(file("routerstat.txt"), -$linestring, $linestring);
      
      $linesoutrev = array_reverse($linesout);
      
      foreach ( $linesoutrev as $line )
      {
          $output .= '' . $line . '<br />';
      }
      
      echo $output;
      
      ?>
      If it's of any use to anyone, great! I find it's a good way to check if/when there's downtime.
      NewsreadeR likes this.

    2. The Following User Says Thank You to ant_thomas For This Useful Post:

      WheelNutWalter (08-10-12)


    3. Advertisement
    4. #2
      WheelNutWalter's Avatar
      WheelNutWalter is offline Sky User Member
      Exchange: LCHEY
      Broadband ISP: Sky Max/Unlimited
      Router: Sagemcom 2504N
      Sky TV: Sky+HD box
      Join Date
      Aug 2011
      Posts
      94
      Thanks
      10
      Thanked 11 Times in 10 Posts

      Re: Bash script to check connection speed - F@ST2504n

      Thanks, I've been thinking about doing something like this, as my download speed drops from 11,000kbps to around 9,000kbps over the period of a few weeks. This will save me having to remember to reboot the router.

    5. #3
      ant_thomas's Avatar
      ant_thomas is offline Sky User Member
      Exchange: Blackfriars
      Broadband ISP: Sky Broadband Unlimited
      Router: Sagem F@ST 2504n
      Sky TV:
      Join Date
      Jul 2007
      Location
      Manchester
      Posts
      12
      Thanks
      0
      Thanked 3 Times in 2 Posts

      Re: Bash script to check connection speed - F@ST2504n

      You're welcome.

      Hopefully it does the job you want.

    6. #4
      ant_thomas's Avatar
      ant_thomas is offline Sky User Member
      Exchange: Blackfriars
      Broadband ISP: Sky Broadband Unlimited
      Router: Sagem F@ST 2504n
      Sky TV:
      Join Date
      Jul 2007
      Location
      Manchester
      Posts
      12
      Thanks
      0
      Thanked 3 Times in 2 Posts

      Re: Bash script to check connection speed - F@ST2504n

      Well, I'm glad I made the script. I doubt Sky or BT can fix this one.

      Turning on my bathroom light causes the dropouts. Rented apartment, this one will be a pain to sort.

     

     

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •  
    SkyUser - Copyright © 2006-2020. SatDish and NewsreadeR | SkyUser is in no way affiliated with Sky Broadband / BSkyB
    RIPA NOTICE: NO CONSENT IS GIVEN FOR INTERCEPTION OF PAGE TRANSMISSION