Cronjob help please

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • marketsmart
    HOMICIDAL TROLL KILLER
    • Dec 2004
    • 20419

    #1

    Cronjob help please

    0,30 * * * * /var/www/virtual/domain.com/htdocs/catcher

    thatsd what i have. not working. catcher is a script that i want to run every 30 minutes. i chmod the script to 755 already...

    can anyone help...

    #!/bin/sh
    #start
    cd /var/www/virtual/domain.com/htdocs
    wget http://www.domain.net/master.txt
    cat /var/www/virtual/domain.com/htdocs/master.txt >> /var/www/virtual/domain.com/htdocs/mastercomp.txt
    #end

    thats the script i need to run. basically it pulls a .txt from a location and appends the mastercomp.txt

    any help appreciated....
  • marketsmart
    HOMICIDAL TROLL KILLER
    • Dec 2004
    • 20419

    #2
    bump init.d....

    Comment

    • marketsmart
      HOMICIDAL TROLL KILLER
      • Dec 2004
      • 20419

      #3
      bump sudo su -.....

      Comment

      • marketsmart
        HOMICIDAL TROLL KILLER
        • Dec 2004
        • 20419

        #4
        www.bump.com

        wtf.. i know all the admins arent in vegas.... mine is sleeping and wont wake up...

        Comment

        • marketsmart
          HOMICIDAL TROLL KILLER
          • Dec 2004
          • 20419

          #5
          one last bump...

          Comment

          • duckduckgoose
            Registered User
            • Mar 2006
            • 82

            #6
            what do your cron logfiles say? check /var/log/cron (or similar location on your system). this will tell you whether it is a problem with the script itself, or what.

            does the script run and work correctly when you run it by hand?
            rRhino.com ...social networking for book fans...

            Comment

            • marketsmart
              HOMICIDAL TROLL KILLER
              • Dec 2004
              • 20419

              #7
              ./catcher: /bin/sh^M: bad interpreter: No such file or directory
              thats what i just got when i tried to run it manuelly....

              Comment

              • MattX
                Registered User
                • Jan 2006
                • 6

                #8
                Mostly a lurker, but figured id help.

                30 * * * * /path/whateveryouwanttorun

                Will run that script every 30 minutes. Remove that 0, you have.

                Goes min, hour, day of month, month, day of week.

                Comment

                • duckduckgoose
                  Registered User
                  • Mar 2006
                  • 82

                  #9
                  If i'm not mistaken, the 30 alone means it will run at :30 of every hour, day, etc. His intention seems originally to run it every half hour, meaning at :00 and :30.

                  also, the message "bad interpreter: No such file or directory" in this situation usually means you don't have that shell installed. Try putting /bin/bash instead and see if it runs manually then. Some systems just don't have the original Bourne shell installed anymore.
                  Last edited by duckduckgoose; 07-12-2006, 12:16 AM.
                  rRhino.com ...social networking for book fans...

                  Comment

                  • MattX
                    Registered User
                    • Jan 2006
                    • 6

                    #10
                    Sorry, hes right. take 4:30am advice for what it is. Your original cron will run every 30 minutes.

                    problem is just your shell.. see if its even there, most likely just linked to bash. swap or fix, should be fine then.

                    Comment

                    • marketsmart
                      HOMICIDAL TROLL KILLER
                      • Dec 2004
                      • 20419

                      #11
                      Originally posted by duckduckgoose
                      If i'm not mistaken, the 30 alone means it will run at :30 of every hour, day, etc. His intention seems originally to run it every half hour, meaning at :00 and :30.

                      also, the message "bad interpreter: No such file or directory" in this situation usually means you don't have that shell installed. Try putting /bin/bash instead and see if it runs manually then. Some systems just don't have the original Bourne shell installed anymore.
                      that didnt seem to help.. still got same error...

                      Comment

                      • marketsmart
                        HOMICIDAL TROLL KILLER
                        • Dec 2004
                        • 20419

                        #12
                        /bash is in /bin and /sh is linked to /bash....

                        Comment

                        • marketsmart
                          HOMICIDAL TROLL KILLER
                          • Dec 2004
                          • 20419

                          #13
                          is it possible that i need to drop the script in cgi-bin or outside of htdocs?

                          Comment

                          • duckduckgoose
                            Registered User
                            • Mar 2006
                            • 82

                            #14
                            the first line in the script is often called the "bang line", and it points to the shell used to execute the script. if the two shell location paths you have tried so far (/bin/sh and /bin/bash) don't work, you need to determine which shells are available to be used, and where they are located on your system.

                            check other existing working scripts on the same system to determine the shell they are using, and then try using the same shell and location in your script here.
                            rRhino.com ...social networking for book fans...

                            Comment

                            • marketsmart
                              HOMICIDAL TROLL KILLER
                              • Dec 2004
                              • 20419

                              #15
                              thanks for all your help guys.. it was the script. i uploaded it from my box and it was seeing it incorrectly. i manually added the script through vi and its working now...

                              Comment

                              • fuzebox
                                making it rain
                                • Oct 2003
                                • 22352

                                #16
                                An easy fix would be to change your cron line to this:

                                0,30 * * * * sh /var/www/virtual/domain.com/htdocs/catcher

                                Comment

                                • fuzebox
                                  making it rain
                                  • Oct 2003
                                  • 22352

                                  #17
                                  Ah, so the real problem was probably hidden line break characters then... What are you using to edit files?

                                  Comment

                                  • marketsmart
                                    HOMICIDAL TROLL KILLER
                                    • Dec 2004
                                    • 20419

                                    #18
                                    Originally posted by fuzebox
                                    Ah, so the real problem was probably hidden line break characters then... What are you using to edit files?
                                    TextPad which is normally good and has no issues.. i must have missed something... thanks for all the help the advice helped me rule out other problems and got the brain going...

                                    Comment

                                    • jimthefiend
                                      So Fucking Banned
                                      • Oct 2003
                                      • 18889

                                      #19
                                      I could help you but I won't.

                                      Comment

                                      • drjones
                                        Confirmed User
                                        • Oct 2005
                                        • 908

                                        #20
                                        Originally posted by marketsmart
                                        TextPad which is normally good and has no issues.. i must have missed something... thanks for all the help the advice helped me rule out other problems and got the brain going...

                                        Textpad will save the files in windows format wich uses ^M for carriage returns. Since linux/unix doesnt recognize ^M as a carriage return it will give you problems. Most linux distros usually come with two handy little tools for this situation.. remember these

                                        dos2unix
                                        unix2dos
                                        ICQ: 284903372

                                        Comment

                                        Working...