Help Needed (please) with a VERY simple script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tipster69
    Member
    • Dec 2008
    • 91

    #1

    Help Needed (please) with a VERY simple script

    Hi,

    I have my DM800HD set up for use when on the road (Motorhome) using a Netgear MBR624GU Mobile Router and a Huawei E220 Modem.

    It works fine for x amount of time and then it starts to jitter, we seem to have got to the root of the problem in that the Modem drops from HSDPA mode into UMTS because of lack of data (i.e I update the EPG then the jittering stops because the modem goes back to HSDPA Mode).

    I have read of a similar problem that was fixed by writing a very simple script to PING an IP address every x amount of seconds (I think it was every 2 seconds) and this worked.

    My problem is I have no idea how to write or use a script on a DM800. Could someone PLEASE help me by advising in laymans terms how I do it.

    THANKS IN ADVANCE
    Last edited by tipster69; 26 March, 2012, 22:19.
  • tipster69
    Member
    • Dec 2008
    • 91

    #2
    Hi,

    I have added a one line sript called ping.sh with nothing other than "PING bbc.co.uk" in it.

    I have run the script from the script executor on the remote and whilst it has the desired effect of sending a ping every second, I have no way of leaving it running in the background which is what I need to do.

    PLEASE HELP!

    Comment

    • tipster69
      Member
      • Dec 2008
      • 91

      #3
      Hi,

      Can anyone help with this? Any script experts about.

      Thanks

      Comment

      • davvo
        DK Veteran
        • Apr 2009
        • 666

        #4
        you need to set up a crontab and script for your image
        a crontab will run the script every 2 seconds

        and ping the ip 173.194.78.94

        thats google

        i will try and make one for you tonight

        what image r u using

        Comment

        • tipster69
          Member
          • Dec 2008
          • 91

          #5
          Hi Davvo,

          That would be VERY MUCH APPRECIATED, the kids are driving me mad with the Disney Channel Jittering like it is.

          CHEERS

          Comment

          • davvo
            DK Veteran
            • Apr 2009
            • 666

            #6
            files at bottom of page

            ok iv made the script
            it works and setup the crontab on
            Dream Elite BH Phoenix Edition 2

            the crontab will only work in minutes hours days months
            not seconds
            so i got it down to ping google every 1 minute


            here is the script put in usr/script
            name it ping.check.sh give it 755


            Code:
            ping -c 5 173.194.67.94
            if [[ $? != 0 ]]; then
                date '+%Y-%m-%d %H:%M:%S Connection Unavailable' >> /var/log/checkconnection.log
            else
                date '+%Y-%m-%d %H:%M:%S Connection Available' >> /var/log/checkconnection.log
            fi
            make a file in var/log
            called checkconnection.log give it 644

            then if your using dream elite PHOENIX
            go to
            var/etc/bhcron
            make a file called root
            inside root paste this and give it 755

            */1 * * * * /usr/script/ping.check.sh

            then reboot

            go to var/log checkconnection.log

            and you will see that it has pinged google every one minute

            and it will log like this

            2012-03-27 14:36:05 Connection Available
            2012-03-27 14:37:05 Connection Available
            2012-03-27 14:38:05 Connection Available
            2012-03-27 14:39:05 Connection Available
            2012-03-27 14:40:05 Connection Available
            2012-03-27 14:41:05 Connection Available
            2012-03-27 14:42:05 Connection Available
            2012-03-27 14:43:05 Connection Available
            2012-03-27 14:44:05 Connection Available

            to make it easy
            iv also posted all 3 files here
            just put in right places give chmod rights as above






            Attached Files
            Last edited by davvo; 27 March, 2012, 17:23.

            Comment

            • tipster69
              Member
              • Dec 2008
              • 91

              #7
              Hi,

              MANY THANKS for taking the time out to do this for me it really is VERY MUCH APPRECIATED.

              I will do this now.

              Out of interest, if pinging once every minute is not enough for it to work. Is there an other option of me adding no timer to the ping, i.e it just pings constantly (i.e like every second). I have read of another person having success doing it this way.

              THANKS AGAIN for your help.

              Comment

              • davvo
                DK Veteran
                • Apr 2009
                • 666

                #8
                if 1 minute is not enough

                i could try and make a while bash loop script

                but give the 1 minute crontab a go first

                Comment

                • tipster69
                  Member
                  • Dec 2008
                  • 91

                  #9
                  Hi,

                  It is just rebooting now, gonna try it on my 3G Dongle in the house now.

                  THANKS

                  Comment

                  • tipster69
                    Member
                    • Dec 2008
                    • 91

                    #10
                    Hi Davvo,

                    I have the script running now (I have checked the log file it is definitely running).

                    Unfortunately, the once a minute mustn't be enough to keep the modem in HSDPA Mode as it is still jittering.

                    Ideally if there was a variable (or just a number that I knew was timing related) I could edit to find the timing that would work best with it, that would be great.

                    Any further help would also be great.

                    CHEERS

                    EDIT: Is the -c for the number of pings it sends? If so could I increase this to keep pinging xx amount of times per minute?

                    EDIT 2: Changed the count to 20, it is definitely having some effect, as it doesn't glitch nearly as much -DAVVO, I OWE YOU A DRINK MATE, THIS WAS VERY KIND OF YOU - CHEERS
                    Last edited by tipster69; 27 March, 2012, 20:40.

                    Comment

                    • davvo
                      DK Veteran
                      • Apr 2009
                      • 666

                      #11
                      file is at bottom of page

                      this will ping google every 1 second

                      keep all the 3 files you had before

                      now place this in usr/script
                      and name it every-1-seconds.sh give it 755

                      Code:
                      while true
                      do
                       /usr/script/ping.check.sh
                       sleep 1 then
                       echo "ping google 1 sec OK!" >> /var/log/checkconnection.log
                      
                       done
                      start dcc telnet and paste this in

                      /usr/script/every-1-seconds.sh

                      that will start the loop script

                      press CTRL+C to stop

                      check the log in
                      var/log checkconnection.log


                      i cant get nohup to run the script
                      so you will have to start it this way
                      Attached Files
                      Last edited by davvo; 27 March, 2012, 20:53.

                      Comment

                      • tipster69
                        Member
                        • Dec 2008
                        • 91

                        #12
                        Hi,

                        Thanks again for going out of your way to help. I know I keep repeating myself, but it is genuinely mega appreciated.

                        CHEERS MATE.

                        Comment

                        • tipster69
                          Member
                          • Dec 2008
                          • 91

                          #13
                          Hi,

                          With regards to how I would start this script, does this mean I need to access the box via PC to start it? Because it will be used whilst away in the Motorhome I wouldn't normally have a PC to access the box.

                          I am unsure if I understand this correctly, though I am sure there is a way around it perhaps via my iphone or ipad?

                          Cheers
                          Last edited by tipster69; 27 March, 2012, 21:24.

                          Comment

                          • davvo
                            DK Veteran
                            • Apr 2009
                            • 666

                            #14
                            the 1 sec script yes you will need to start it by pc
                            unless i can get it to run at boot
                            as the crontab that normally starts is stuck at 1 min

                            the ping.check.sh script change the -c 5 to -c 60
                            and see if it pings more

                            did you try the 1 sec script and did it stop the jittering
                            Last edited by davvo; 27 March, 2012, 21:32.

                            Comment

                            • tipster69
                              Member
                              • Dec 2008
                              • 91

                              #15
                              Hi Davvo,

                              I have been having a play with the -c and currently at -c 35 it is working very very well with only a little jittering (watchable and a 100x times better than before, which is why I am eternally grateful for your help).

                              Out of interest, I am using my PC now to test this, but I am thinking when out in the field I may want to edit your script to fine tune it to suit the situation. Is there a plugin that will allow me to edit your script via the remote control rather than via ftp?

                              Cheers

                              edit: Just when I think it is sussed the bugger starts jittering again though I am hoping it could be down to a poor signal as it as been much better since using your script
                              Last edited by tipster69; 27 March, 2012, 21:40.

                              Comment

                              Working...