Crontab Help

Discussion in 'Site & Server Administration' started by scottmweaver, Jan 23, 2008.

  1. #1
    Hey guys,

    I'm trying to set up a cron job that will run tomorrow (Thursday), every minute between 5:30 AM and 5:30 PM.

    Please let me know if this is possible and if it is, how to do it. :)

    Scott
     
    scottmweaver, Jan 23, 2008 IP
  2. scottmweaver

    scottmweaver Peon

    Messages:
    1,181
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    0
    #2
    So far, I just set up the hours and tried the following (just to test for today) yet to no avail:

    * 18-19 23 1 3 php /var/www/html/timestamper.php

    According to cron docs, this should be every minute between 6 and 7 pm on the 23rd day of the first month on Wednesday. The problem isn't that it doesn't execute, the problem is that it does.

    So when I change the date to 24, it keeps running. What am I doing wrong?
     
    scottmweaver, Jan 23, 2008 IP
  3. linsys

    linsys Peon

    Messages:
    274
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    First:

    1) Make sure the date is set right on the server, type date, if its wrong fix it.

    2) you need three cron entries for this

    30-59 5 * * 4 php /var/www/html/timestamper.php
    * 6-16 * * 4 php /var/www/html/timestamper.php
    1-30 17 * * 4 php /var/www/html/timestamper.php

    There you go

    So the first one says run this cron job between 5:30-5:59AM on thursdays
    The second one days every minute 6am - 4pm on Thursdays
    the third one says every minute starting at 5:01-5:30PM

    hope that helps.
     
    linsys, Jan 23, 2008 IP
  4. linsys

    linsys Peon

    Messages:
    274
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Your example Cron looks right, could be the date is set wrong on the server..
     
    linsys, Jan 23, 2008 IP
    scottmweaver likes this.
  5. scottmweaver

    scottmweaver Peon

    Messages:
    1,181
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    0
    #5
    linsys: Thanks a ton man. I ran some tests and it looks like I can finally get out of here. :D
     
    scottmweaver, Jan 23, 2008 IP