[email protected] Posted April 9, 2009 Share Posted April 9, 2009 Hi All, Am trying to schedule some cron job tasks and am alightly confused with the right date and time settings for the following scenarios (1) Run a php file every week on a sunday at 9AM 1 9 * * 7 (2) Run a php file every two weeks on a monday at 11AM 2 11 * * 1 Am i right with the above settings? If not can anyone please correct me. Cheers Link to comment https://forums.phpfreaks.com/topic/153392-cron-job-time-and-date-settings/ Share on other sites More sharing options...
herghost Posted April 9, 2009 Share Posted April 9, 2009 Hope this helps: * * * * * command to be executed - - - - - | | | | | | | | | +----- day of week (0 - 6) (Sunday=0) | | | +------- month (1 - 12) | | +--------- day of month (1 - 31) | +----------- hour (0 - 23) +------------- min (0 - 59) Yours should be 0 9 * * 0 and I dont know how you would do the second one! Link to comment https://forums.phpfreaks.com/topic/153392-cron-job-time-and-date-settings/#findComment-805906 Share on other sites More sharing options...
Maq Posted April 10, 2009 Share Posted April 10, 2009 Cron doesn't have an option of every other day of the week, at least, not that I know of. But you can test to see if the cronjob was run last week via a small bash script: if test -f /dir/lastweek then rm /dir/lastweek exit fi touch /dir/lastweek run the job Link to comment https://forums.phpfreaks.com/topic/153392-cron-job-time-and-date-settings/#findComment-806029 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.