[Cron Job] On a weekly basis

Aziz

Verified User
Joined
Oct 4, 2004
Messages
126
I have four scripts to run, one on daily basis, weekly,monthly and yearly..

I think I got three, but the weekly I am kinda stuck on it...
PHP:
For the daily I did:

59    23    1-31     1-12      0-7 

Monthly:
59     23      30       1-12    0-7 
For the yearly:

59     23       30         12      0-7 

Now the weekly, can I do this to make it work:
59       23       7        1-12     0-7
will it be accurate, since some months (feb) got only 28 days..

I appreciate any help anyone can offer,

Thanks,
Aziz
 
Why not just do something like:
59 23 * * 0
which should run it every Sunday at 23:59 I think. Might need to verify.
 
jmstacey said:
Why not just do something like:
59 23 * * 0
which should run it every Sunday at 23:59 I think. Might need to verify.

Thanks I will try...

was the ones I posted for the other times correct too :eek:

I just want to make sure im getting it.

Thanks,
Aziz
 
They appear so, however you do not need to specify the range unless you are intending to limit the times in which the cron is run, which does not appear to be the case on some of them.
For example on the daily cron
Code:
59 23 * * * command
or thereabouts should accomplish the same thing and is a lot easier.
 
Back
Top