Script install into 500s gp 4.7 maxvar

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • reno
    Newbie
    • Aug 2009
    • 1

    #1

    Script install into 500s gp 4.7 maxvar

    hi guys i am needing desperate help in how to install a script into my greambox 500s. i am trying to install a restart script for the latest cccam so that it restarts every 5 mins and cant do it for the life of me. i have no telnet experience what so ever is there a DUMMIES guide out there to help me with my situation.

    Many Thanks

    Reno.........
  • Ansem

    #2
    this will work for Gemini 4.2, but you will have to test on 4.7

    paste this in notepad and save it as ccheck.sh

    Code:
    #!/bin/sh
    if ps x |grep -v grep |grep -c CCcam >/dev/null
    then
     echo "cccam... ok"
    else
     echo "cccam... restarting"
    /var/bin/[COLOR=Red]CCcam_2.2.1[/COLOR] &
    fi
    see above script marked in red, input the version of CCcam you will be using,

    ftp the file to the dreambox into /var/script

    set the file attributes to 755


    then in the dm500 menu, follow the steps below:

    1. Press Blue button
    2. Press Extra/Setup
    3. Press Services/Daemon
    4. goto Crond section and press Setup
    5. Press New
    6. Now you have to decide how frequent you want this script to run example every 30mins ( In this case make sure you only have 30 in the minutes section)
    7. go on the last line Command and press ok ( A selection window should open)
    8. Select the script from the list, in this case you should look for ccheck.sh or whatever name you used earlier to save it. press ok when you find the script and should return to the previous menu.
    9. Press Save once more and then exit.
    10. if all was done ok it should check if CCcam is running and if not it will start it for you!! You can test this by changing to common interface and wait for the amount of minutes you specified earlier.

    i hope this helps you
    Last edited by Guest; 4 January, 2011, 23:03. Reason: added info

    Comment

    • mark1832
      Banned
      • Feb 2009
      • 32

      #3
      Hi all,
      I done the same script widely avavlable on the forum un my IBM server with UBUNTU 10.0.

      If i manually kill cccam and start the script it say cccam restarting but with ps fax or ps -x the ccam it is not showed in the process... If i run my line manually then it start.... damn it! (/usr/local/bin/CCcam.x86 &).. I tried sevral folder and to chmod the script 755 and 777 ... nada does not want to start it...
      ANy idea please ?

      Thanks
      Last edited by mark1832; 9 February, 2011, 01:29. Reason: mistake

      Comment

      • PaphosAL
        Old Git
        • Mar 2008
        • 1064

        #4
        You've probably written your script in Windoze Notepad or Wordpad, so it contains hidden EOL codes that prevent Linux from executing the script.

        Run this command in Telnet:

        dos2unix /var/script/ccheck.sh

        and then try again. And use a proper Text Editor, like Notepad++ (Freeware), where you can change the document format from DOS/Windows to Unix/ANSI very easily.

        Or find the file with TuxCom and press Blue to 'Linux Format' it, then Save.

        Cheers- AL

        Comment

        • mark1832
          Banned
          • Feb 2009
          • 32

          #5
          hi, PLEASE BEAR IN MIND THIS IT IS NOT A DREAMBOX BUT AN IMB SERVER WITH UBUNTU 10.0...........Went into my checkcccam.sh with VIM and retyped everything...nada same problem...

          cccam... ok
          root@mark1832-desktop:/usr/local/bin# killall CCcam.x86
          root@mark1832-desktop:/usr/local/bin# sh checkcccam
          cccam... restarting
          root@mark1832-desktop:/usr/local/bin# sh checkcccam
          cccam... restarting
          root@mark1832-desktop:/usr/local/bin# sh checkcccam
          cccam... restarting
          root@mark1832-desktop:/usr/local/bin# /usr/local/bin/CCcam.x86 &
          [1] 2357
          root@mark1832-desktop:/usr/local/bin# dos2unix /usr/local/bin/checkcccam.sh
          dos2unix: command not found
          [1]+ Done /usr/local/bin/CCcam.x86
          [1]+ Done /usr/local/bin/CCcam.x86
          root@mark1832-desktop:/usr/local/bin#


          This is driving me crazy!
          Plwease help!


          #!/bin/sh
          if ps x |grep -v grep |grep -c CCcam.x86 >/dev/null
          then
          echo "cccam... ok"
          else
          echo "cccam... restarting"
          # killall -9 /usr/local/bin/CCcam.x86
          /usr/local/bin/CCcam.x86
          fi


          *******************************************

          I downloaded notepad++ and saved as .sh
          when i run it say

          -rwxrwxrwx 1 mark1832 mark1832 806864 2010-11-19 14:25 CCcam.x86
          -rwxr-xr-x 1 mark1832 mark1832 191 2011-02-09 11:20 checkcccam.sh
          root@mark1832-desktop:/usr/local/bin# dos2unix /usr/local/bin/checkcccam.sh
          dos2unix: command not found
          root@mark1832-desktop:/usr/local/bin# sh checkcccam
          sh: Can't open checkcccam
          root@mark1832-desktop:/usr/local/bin# sh checkcccam.sh
          checkcccam.sh: 9: Syntax error: "fi" unexpected (expecting "then"


          shall i change fi with [ ] ???
          Last edited by mark1832; 9 February, 2011, 13:13. Reason: mistake

          Comment

          • PaphosAL
            Old Git
            • Mar 2008
            • 1064

            #6
            This error message:
            Code:
            [COLOR=red]checkcccam.sh: 9: Syntax error: "fi" unexpected (expecting "then"[/COLOR]
            tells you that there is something seriously wrong with the first two lines of the script:
            Code:
             
            [COLOR=red]if ps x |grep -v grep |grep -c CCcam.x86 >/dev/null[/COLOR]
            [COLOR=red]then[/COLOR]
            So, there's a syntax error there, and it's not picking up the then statement. Only guessing, but I'd have expected the first line to read more like:
            Code:
             
            [COLOR=blue]if [ ps x |grep -v grep |grep -c CCcam.x86 >/dev/null ] ; then[/COLOR]
            and it might be worth your while activating the killall line, be removing the # comment. In your manual Terminal testing, you've ran the script to restart CCcam three times in succession without killing it, which means THREE CCcams are now loaded into memory! Not conducive to debugging...

            Cheers- AL

            Comment

            • mark1832
              Banned
              • Feb 2009
              • 32

              #7
              put the bracket as you said and now we got :

              root@mark1832-desktop:/usr/local/bin# sh checkcccam.sh
              checkcccam.sh: 10: Syntax error: end of file unexpected (expecting "then")
              damn it!
              there must be something that ubuntu screw up

              Comment

              • PaphosAL
                Old Git
                • Mar 2008
                • 1064

                #8
                Let's see your revised script, exactly as it now stands, please. AL

                Comment

                • mark1832
                  Banned
                  • Feb 2009
                  • 32

                  #9
                  many thanks for all you help ok ?

                  #!/bin/sh
                  if [ ps x |grep -v grep |grep -c CCcam.x86 >/dev/null ] ;
                  then
                  echo "cccam... ok"
                  else
                  echo "cccam... restarting"
                  killall -9 /usr/local/bin/CCcam.x86
                  /usr/local/bin/CCcam.x86
                  fi

                  even if i remove the ; before the first then it stay the same error

                  root@mark1832-desktop:/usr/local/bin# ls -l
                  total 792
                  -rwxrwxrwx 1 mark1832 mark1832 806864 2010-11-19 14:25 CCcam.x86
                  -rwxr-xr-x 1 mark1832 mark1832 196 2011-02-10 08:47 checkcccam.sh
                  root@mark1832-desktop:/usr/local/bin# sh checkcccam.sh
                  checkcccam.sh: 10: Syntax error: end of file unexpected (expecting "then")
                  root@mark1832-desktop:/usr/local/bin# sh checkcccam.sh
                  checkcccam.sh: 10: Syntax error: end of file unexpected (expecting "then")
                  root@mark1832-desktop:/usr/local/bin#

                  Comment

                  • mark1832
                    Banned
                    • Feb 2009
                    • 32

                    #10
                    i tried this one:

                    #!/bin/sh
                    if [ `ps x | grep -v grep | grep -c CCcam.x86` -gt 0 ];
                    then
                    echo "cccam... ok"
                    else
                    echo "cccam... restarting"
                    # killall -9 /usr/local/bin/CCcam.x86
                    /usr/local/bin/CCcam.x86 &
                    fi

                    now as before it run but in ps -x or ps -fax cccam it is not started!

                    Comment

                    • mark1832
                      Banned
                      • Feb 2009
                      • 32

                      #11
                      please see picture attached
                      Attached Files

                      Comment

                      • PaphosAL
                        Old Git
                        • Mar 2008
                        • 1064

                        #12
                        Mark- the more I look at this script, the more it looks like there is either something vital missing on the grep front in that first line, or the syntax is wrong.

                        That stuff is way over my head, so I'm going to ask LraiZer to look at your current script, to see if he has a better idea to accomplish what it is you are trying to achieve.

                        Watch this space...

                        AL

                        Comment

                        • mark1832
                          Banned
                          • Feb 2009
                          • 32

                          #13
                          I found the solution! :
                          for some reasons ubuntu want sudo before executing the else statement sorted! thanks to all... i also made a script to log any failure and restrting of cccam
                          if anybody want it please pm me!

                          killall CCcam.x86
                          sleep 2
                          sudo /usr/local/bin/CCcam.x86 &
                          fi

                          Comment

                          • LraiZer
                            Top Poster
                            • May 2008
                            • 126

                            #14
                            try just changing the script from sh to bash?
                            Code:
                            [COLOR="Red"][B]#!/bin/bash[/B][/COLOR]
                            if ps x |grep -v grep |grep -c CCcam >/dev/null
                            then
                             echo "cccam... ok"
                            else
                             echo "cccam... restarting"
                             /usr/local/bin/CCcam.x86
                            fi
                            Last edited by LraiZer; 10 February, 2011, 20:15. Reason: changed fix to bash version

                            Comment

                            Working...