simple cron job question

Discussion in 'Site & Server Administration' started by getyour, Jul 14, 2006.

  1. #1
    Should cron jobs be entered with or without the quotes - see below?

    Also, how can you test whether a cron job is working?

    Thanks.

    Example:


    “nice –adjustment=19 /usr/bin/php /$full-path-to-the-file/file_name.php”
     
    getyour, Jul 14, 2006 IP
  2. sreyas

    sreyas Well-Known Member

    Messages:
    128
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #2
    You don't need to have the quotes
    30 * * * * nice –adjustment=19 /usr/bin/php /$full-path-to-the-file/file_name.php

    Just keeping this will do
     
    sreyas, Jul 15, 2006 IP
  3. Cryogenius

    Cryogenius Peon

    Messages:
    1,280
    Likes Received:
    118
    Best Answers:
    0
    Trophy Points:
    0
    #3
    To make sure a cronjob is really working, I usually redirect the ouput to a log file. For example:

    .../file_name.php >& cron.log

    or, depending on your shell:

    .../file_name.php > cron.log 2>&1

    Cheers, Cryo.
     
    Cryogenius, Jul 23, 2006 IP
  4. Namesniper

    Namesniper Well-Known Member

    Messages:
    365
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    118
    #4
    Without quotes
     
    Namesniper, Jul 23, 2006 IP
  5. boydysurf

    boydysurf Banned

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Can anyone recommend a good intro to understanding cron jobs?
     
    boydysurf, Jul 27, 2006 IP
  6. colin008

    colin008 Active Member

    Messages:
    162
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    68
    #6
    Change the email address then put this code at the top of your php script and if you cron job fires the script, it will tell you via email.

    // The message
    $message = "Line 1\nLine 2\nLine 3";
    // Send
    mail('someone@hotmail.com', 'The Subject', $message);
     
    colin008, Aug 7, 2006 IP