I need cron job help!

Discussion in 'Apache' started by netpox, Oct 5, 2007.

  1. #1
    I have installed a script and the readme file said to install cron jobs. So i go to cpanel and enter the info it says to entered from the readme file. Here it is:

    Files needs to be added in crontab are in folder cron/
    1. cleanupViewedTables.php(recommended duration: 2 hours)
    2. deleteTrashMail.php (recommended duration: 24 hours)
    3. groupDeleteCron.php (recommended duration: 24 hours)
    4. groupPhotoDeleteCron.php (recommended duration: 2 hours)
    5. groupVideoAutoActivateCron.php (recommended duration: 1 Minute)
    6. groupVideoDeleteCron.php (recommended duration: 2 hours)
    7. groupVideoEncodeCron.php (recommended duration: 1 Minute)
    8. musicAutoActivateCron.php (recommended duration: 1 Minute)
    9. musicDeleteCron.php (recommended duration: 2 hours)
    10. musicEncodeCron.php (recommended duration: 1 Minute)
    11. photoDeleteCron.php (recommended duration: 2 hours)
    12. updateVideoTagCount.php (recommended duration: 2 hours)
    13. userDeleteCron.php (recommended duration: 24 hours)
    14. videoAutoActivateCron.php (recommended duration: 1 Minute)
    15. videoDeleteCron.php (recommended duration: 2 hours)
    16. videoEncodeCron.php (recommended duration: 1 Minute)

    * * * * * GET http://mydomain/cron/videoEncodeCron.php > /dev/null
    59 */2 * * * GET http://mydomain/cron/videoDeleteCron.php > /dev/null
    * * * * * GET http://mydomain/cron/videoAutoActivateCron.php > /dev/null
    59 23 * * * GET http://mydomain/cron/userDeleteCron.php > /dev/null
    59 */2 * * * GET http://mydomain/cron/updateVideoTagCount.php > /dev/null
    59 */2 * * * GET http://mydomain/cron/photoDeleteCron.php > /dev/null
    * * * * * GET http://mydomain/cron/musicEncodeCron.php > /dev/null
    59 */2 * * * GET http://mydomain/cron/musicDeleteCron.php > /dev/null
    * * * * * GET http://mydomain/cron/musicAutoActivateCron.php > /dev/null
    * * * * * GET http://mydomain/cron/groupVideoEncodeCron.php > /dev/null
    * * * * * GET http://mydomain/cron/groupVideoAutoActivateCron.php > /dev/null
    59 */2 * * * GET http://mydomain/cron/groupVideoDeleteCron.php > /dev/null
    59 */2 * * * GET http://mydomain/cron/groupPhotoDeleteCron.php > /dev/null
    59 */2 * * * GET http://mydomain/cron/cleanupViewedTables.php > /dev/null
    59 23 * * * GET http://mydomain/cron/deleteTrashMail.php > /dev/null
    59 23 * * * GET http://mydomain/cron/groupDeleteCron.php > /dev/null


    After i set it up and enter my email to get results i always get this error message in my email:

    /bin/sh: 59: command not found
     
    netpox, Oct 5, 2007 IP
  2. aGig

    aGig Well-Known Member

    Messages:
    428
    Likes Received:
    5
    Best Answers:
    1
    Trophy Points:
    118
    #2
    Try to use wget. Or ask your host what command you can run. Some hosts limit users so they can't use the normal tools.

    Few others are

    curl -s -o
    fetch -o
    lynx >

    Mark
     
    aGig, Oct 5, 2007 IP
  3. Ladadadada

    Ladadadada Peon

    Messages:
    382
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That error message seems to me like they are running that file as if it were a shell script.

    Does cPanel have a way of specifying how often a cron job should be run ? Because, if so, some of that information is redundant and is confusing the interpreter.

    The numbers at the start of each line specify how often the cron job should run. The fields are:

    minutes hours days weeks months command-to-run
    Code (markup):
    so the very last entry:

    59 23 * * * GET http://mydomain/cron/groupDeleteCron.php > /dev/null
    Code (markup):
    runs at the 59th minute of the 23rd hour of every day of every week of every month. The command it runs is:

    GET http://mydomain/cron/groupDeleteCron.php > /dev/null
    Code (markup):
    which isn't a valid shell command that I know of.

    My guess is that you need to create a separate cron job for each of these in cPanel without the numbers and stars at the start of each command and change how often they run to match what the numbers and stars meant. If you get an error message like "/bin/sh: GET: command not found" then try replacing "GET" with "wget" or "curl" as Mark said above.

    Lastly, the "> /dev/null" at the end of each line throws away whatever output the script creates but if that output is an error message, you'll never know why the script isn't working. If you get the scripts running regularly but whatever they are supposed to be doing doesn't happen, try removing that part of the command and see what comes through in your email.

    Dave.
     
    Ladadadada, Oct 6, 2007 IP
    netpox likes this.
  4. netpox

    netpox Active Member

    Messages:
    1,625
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    90
    #4
    thanks dave i'll give that a try
     
    netpox, Oct 6, 2007 IP