Welcome!

Welcome to Satlover forums, full of great people, ideas and excitement.

Please register if you would like to take part. link..

Register Now

Alert: Don't Use Hotmail Email Accounts for registration

Collapse

Before Access to all Forums and Trial accounts you must need to activate your account Email address

Need check script for NO-IP client

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gianni253
    Experienced Board Member
    • Nov 2012
    • 903

    #16
    Re: Need check script for NO-IP client

    Originally posted by SatWaveDude
    @gianni253

    Do you now how I can let auto start noip2 client every time my system reboots?
    If your system is a "pure" debian, move your script (let's say noip2) to the directory /etc/init.d/
    Always be sure it is executable:
    Code:
    chmod 755 /etc/init.d/noip2
    Add the symbolic links using the Debian-specific command update-rc.d:
    Code:
    update-rc.d noip2 defaults
    That's all !

    Comment

    • cisko
      Banned
      • Sep 2012
      • 237

      #17
      Re: Need check script for NO-IP client

      Originally posted by SatWaveDude
      Hi,

      I found out that my NO-IP client sometimes does not update/stopped.

      Do some of you have a script that checks if the client is still running and if not automatic restart the client?

      I need this very badly and have not the Linux skills to do this on my own.

      The OS is Debian 6.0.5
      Hi, you can find if program is still alive with:
      Code:
      ps | grep program_name
      for noip2:
      Code:
      ps | grep noip2

      Comment

      • SatWaveDude
        Board Senior Member
        • Apr 2012
        • 220

        #18
        Re: Need check script for NO-IP client

        @ cisko

        do you now how to write scrip to let it starts automatically if it crash/freezes?
        SatWaveDude

        DM500HD, DM500+ | EMP S16/1PCP-W3 | WaveFrontier T90 | 16x SMART Titanium 0.1dB LNB's
        TechniSat SkyStar S2 PCI / SkyStar USB HD
        WaveFrontier T90 rev.2 - 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 3.3E | 4/5E | 0.8W | 7/8W | 12.5W

        If you find my post usefull please press the Thanks Button

        Comment

        • SatWaveDude
          Board Senior Member
          • Apr 2012
          • 220

          #19
          Re: Need check script for NO-IP client

          This script I found is for checking if oscam is still running and probably can be modified for my purpose.

          Can someone help me please to modify this script?

          Code:
          #!/bin/sh
          
          process=`ps auxwww | grep oscam | grep -v grep | awk '{print $1}'`
          if [ -z "$process" ]; then
          echo "Couldn't find oscam running. Restarting server-binary" >> /var/log/oscam.check
          nohup /usr/local/bin/oscam >> /var/log/oscam.log &
          else
          echo "oscam is still OK!" >> /var/log/oscam.check
          fi
          SatWaveDude

          DM500HD, DM500+ | EMP S16/1PCP-W3 | WaveFrontier T90 | 16x SMART Titanium 0.1dB LNB's
          TechniSat SkyStar S2 PCI / SkyStar USB HD
          WaveFrontier T90 rev.2 - 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 3.3E | 4/5E | 0.8W | 7/8W | 12.5W

          If you find my post usefull please press the Thanks Button

          Comment

          • gianni253
            Experienced Board Member
            • Nov 2012
            • 903

            #20
            Re: Need check script for NO-IP client

            Please, report what "ps" shows when noip is running fine, and write here the command you enter to start noip.
            Only with these infos it will be possible to modify the script ...

            Comment

            • uttnls

              #21
              Re: Need check script for NO-IP client

              Code:
              #!/bin/sh
              
              process=`ps auxwww | grep noip2 | grep -v grep | awk '{print $1}'`
              if [ -z "$process" ]; then
              echo "Couldn't find NoIP2 running. Restarting Service" >> /var/log/oscam.check
              nohup /usr/local/bin/nopi2 >> /var/log/noip2.log &
              else
              echo "NoIP2 is still OK!" >> /var/log/noip2.check
              fi
              make sure your noip2 bin is here: /usr/local/bin/nopi2 or change the path in the above script.

              Comment

              • SatWaveDude
                Board Senior Member
                • Apr 2012
                • 220

                #22
                Re: Need check script for NO-IP client

                @ gianni253

                If I give the command /usr/local/bin/noip2 I receive this in return:

                Code:
                 /usr/local/bin/noip2
                One noip2 process is already active,
                and the multiple instance flag (-M) is not set.
                :/usr/local/bin# One noip2 process is already active,
                -bash: One: command not found
                :/usr/local/bin# and the multiple instance flag (-M) is not set.

                If I give the command /usr/local/bin/noip2 -d I receive this in return:

                Code:
                 /usr/local/bin/noip2 -d
                One noip2 process is already active,
                and the multiple instance flag (-M) is not set.
                
                Shared memory info:
                        size of struct shmid_ds is 112
                        mode 666
                        uid 65534, gid 65534
                        created by uid 65534, gid 65534
                        segment size = 2016
                        last attach time = Mon Jun 10 19:36:54 2013
                        last detach time = Thu Jan  1 01:00:00 1970
                        creation time = Mon Jun 10 19:36:54 2013
                        number of attached procs = 1
                        creation process id = 1336
                        last user process id = 1336
                :/usr/local/bin#
                @uttnls
                As I understand correctly, I have to put the script code in Notepad++ and save it as a UNIX script file that I called noip2check.sh
                This file I put in /var/script

                So when I go the /var/script and give the command ./noip2check.sh this is what it returns:

                Code:
                :/var/script# ./noip2check.sh
                : No such file or directory/bin/sh
                : command not foundne 2:
                ./noip2check.sh: line 9: syntax error near unexpected token `fi'
                ./noip2check.sh: line 9: `fi'
                :/var/script#
                SatWaveDude

                DM500HD, DM500+ | EMP S16/1PCP-W3 | WaveFrontier T90 | 16x SMART Titanium 0.1dB LNB's
                TechniSat SkyStar S2 PCI / SkyStar USB HD
                WaveFrontier T90 rev.2 - 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 3.3E | 4/5E | 0.8W | 7/8W | 12.5W

                If you find my post usefull please press the Thanks Button

                Comment

                • cisko
                  Banned
                  • Sep 2012
                  • 237

                  #23
                  Re: Need check script for NO-IP client

                  Originally posted by SatWaveDude
                  @ cisko

                  do you now how to write scrip to let it starts automatically if it crash/freezes?
                  I'm not a linux script specialist, but you can write something like that:
                  Code:
                  if( "ps | grep noip2" found program) {
                           do nothing, <-- is still working
                  }
                  else {
                           ./noip2 <-- you have to restart your program
                  }

                  Comment

                  • gianni253
                    Experienced Board Member
                    • Nov 2012
                    • 903

                    #24
                    Re: Need check script for NO-IP client

                    Just to keep script as simple as possible ... (I guess you don't need logging)
                    Code:
                    #!/bin/sh
                    
                    if [ "$(pidof noip2)" ]
                    then
                    echo "noip2 running ok"
                    else
                    echo "noip2 not running. Starting noip2 ..."
                    /usr/local/bin/noip2
                    fi
                    exit 0
                    Be sure to use an editor for unix files (notepad++ is ok), name it noip2check.sh, upload it in /var/script, chmod it 755, run it to test with command /var/script/noip2check.sh.
                    If it's ok, put the command in crontab every 30 minutes and you are done.

                    Comment

                    • SatWaveDude
                      Board Senior Member
                      • Apr 2012
                      • 220

                      #25
                      Re: Need check script for NO-IP client

                      @gianni253
                      I like to report that I runs perfectly.
                      Howerver I need some info on how I put this in crontab I do not now what that is?
                      SatWaveDude

                      DM500HD, DM500+ | EMP S16/1PCP-W3 | WaveFrontier T90 | 16x SMART Titanium 0.1dB LNB's
                      TechniSat SkyStar S2 PCI / SkyStar USB HD
                      WaveFrontier T90 rev.2 - 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 3.3E | 4/5E | 0.8W | 7/8W | 12.5W

                      If you find my post usefull please press the Thanks Button

                      Comment

                      • gianni253
                        Experienced Board Member
                        • Nov 2012
                        • 903

                        #26
                        Re: Need check script for NO-IP client

                        Glad to know that your script is running fine !

                        About cron:
                        well, you have cron running, because I saw from pstree result you posted earlier.
                        So, you only need to add an entry in crontab file.
                        Edit /etc/crontab (it's up to you if you prefer editing from inside the box or using an ftp client such as CuteFtp, Filezilla etc.etc.) and add three lines like this (first line is a comment)
                        Code:
                        # check noip every 30 minutes
                        00 * * * * root /var/script/noip2check.sh
                        30 * * * * root /var/script/noip2check.sh
                        Restart cron (or reboot system).
                        With these two lines added, noip2check.sh will be executed by root user at min. 00 and 30 at every hour of every day, i.e. every 30 minutes.

                        Comment

                        • SatWaveDude
                          Board Senior Member
                          • Apr 2012
                          • 220

                          #27
                          Re: Need check script for NO-IP client

                          You have helped me a lot dude!

                          Well for editing file I always use WinSCP to edit files on my Debian/Ubuntu system it's also very simple to change the file previledges with this program. (it's for lazy people I guess) ;-)

                          So cron is not standard running when you have a clean installed Debian or Ubuntu?
                          SatWaveDude

                          DM500HD, DM500+ | EMP S16/1PCP-W3 | WaveFrontier T90 | 16x SMART Titanium 0.1dB LNB's
                          TechniSat SkyStar S2 PCI / SkyStar USB HD
                          WaveFrontier T90 rev.2 - 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 3.3E | 4/5E | 0.8W | 7/8W | 12.5W

                          If you find my post usefull please press the Thanks Button

                          Comment

                          • gianni253
                            Experienced Board Member
                            • Nov 2012
                            • 903

                            #28
                            Re: Need check script for NO-IP client

                            Originally posted by SatWaveDude
                            So cron is not standard running when you have a clean installed Debian or Ubuntu?
                            yes, it's standard, but if it's not running for any reason, it becomes quite hard to troubleshoot a problem when you take for granted something that is not true ...
                            So, my approach, is to always double check every detail that takes part .

                            Comment

                            • SatWaveDude
                              Board Senior Member
                              • Apr 2012
                              • 220

                              #29
                              Re: Need check script for NO-IP client

                              I was suprised what is all in the crontab file since I have not add any line to it, so I guess it's the oscam install script I have used that have add all these lines where i'm not aware of:

                              Code:
                              # /etc/crontab: system-wide crontab
                              # Unlike any other crontab you don't have to run the `crontab'
                              # command to install the new version when you edit this file
                              # and files in /etc/cron.d. These files also have username fields,
                              # that none of the other crontabs do.
                              
                              SHELL=/bin/sh
                              PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
                              
                              # m h dom mon dow user	command
                              17 *	* * *	root    cd / && run-parts --report /etc/cron.hourly
                              25 6	* * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
                              47 6	* * 7	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
                              52 6	1 * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
                              #
                              
                              # check noip every 30 minutes
                              00 * * * * root /var/script/noip2check.sh
                              30 * * * * root /var/script/noip2check.sh
                              
                              56 03 * * * root killall CCcam.x86_64
                              56 03 * * * root killall oscam
                              57 03 * * * root /var/script/configupdate.sh >> /var/cccamlog/configupdate.log
                              58 03 * * * root /var/script/keyupdater.sh
                              59 03 * * * root /usr/local/bin/CCcam.x86_64
                              59 03 * * * root /usr/local/bin/oscam -b
                              */5 * * * * root /var/script/CCcamCheck.sh
                              */5 * * * * root /var/script/OscamCheck.sh
                              03 04 * * 6 root /var/script/LogCleanUp.sh >> /var/cccamlog/CleanUp.log
                              56 03 * * * root killall CCcam.x86_64
                              56 03 * * * root killall oscam
                              57 03 * * * root /var/script/configupdate.sh >> /var/cccamlog/configupdate.log
                              58 03 * * * root /var/script/keyupdater.sh
                              59 03 * * * root /usr/local/bin/CCcam.x86_64
                              59 03 * * * root /usr/local/bin/oscam -b
                              */5 * * * * root /var/script/CCcamCheck.sh
                              */5 * * * * root /var/script/OscamCheck.sh
                              03 04 * * 6 root /var/script/LogCleanUp.sh >> /var/cccamlog/CleanUp.log
                              SatWaveDude

                              DM500HD, DM500+ | EMP S16/1PCP-W3 | WaveFrontier T90 | 16x SMART Titanium 0.1dB LNB's
                              TechniSat SkyStar S2 PCI / SkyStar USB HD
                              WaveFrontier T90 rev.2 - 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 3.3E | 4/5E | 0.8W | 7/8W | 12.5W

                              If you find my post usefull please press the Thanks Button

                              Comment

                              • gianni253
                                Experienced Board Member
                                • Nov 2012
                                • 903

                                #30
                                Re: Need check script for NO-IP client

                                Originally posted by SatWaveDude
                                I was suprised what is all in the crontab file since I have not add any line to it, so I guess it's the oscam install script I have used that have add all these lines where i'm not aware of:
                                Yes, there is a lot of stuff that surely doesn't come with a plain debian install.
                                There are many activities scheduled on a daily basis about a 4 am and they all are mainly related to osc*am and ccc*am housekeeping (restrting and cleaning logs) + key*s updating

                                Comment

                                Working...