Ryan Flynn (email@example.com | www.parseerror.com | www.phpsex.com) irc.dal.net->#php->pizza_milkshake LATEST, GREATEST: http://www.phpsex.com/classes/readme.Scheduler.txt IF YOU WANT TO SKIM OVER THIS, PLEASE AT LEAST READ THE BOTTOM SECTION "EXAMPLES". YOU CAN ALWAYS COME BACK AND ACTUALLY READ IT WHEN YOU RUN INTO PROBLEMS. The syntax of the date rules are similiar to cron/crontab SECOND MINUTE HOUR DAY MONTH each field is whitespace-delimited, meaning you can use on or more SPACES " ", TABS "\t" or NEWLINES "\n" SECOND MINUTE HOUR MONTH Second, Minute, Hour and Month all have exactly the same syntax. They can take single values, wildcards, sets and ranges: Single Value: 5 0 59 Wildcards: * For seconds or minutes, * is equivalent to the range 0-59 For hours * is equivalent to the range 0-23 For days * is equivalent to the range Mon-Sun For months * is equivalent to the range 1-12 NOTE: Wildcard matching perform slightly better than the alternative ranges. Use them if possible. Sets: 0,20,40 0,5,10,15,20,25,30,35,40,45,50,55 1,3,5,7,9,11 5-10,15-20 (not this is a set of ranges) *,5 (equivalant to a single *) Ranges: 1-5 0-59 (for seconds or minutes this is equivalent to '*') DAYS Days are more flexible but also more confusing. We have everything from the other fields, but we have conditionals added. There are two conditions: Sign Rough Translation -------------------------------------------- & Only if it's ! Only if it isn't With the added conditionals we can do things like: 1-7&Fri Meaning, logically, "if the day of the month is less than 8 and the current day is Friday" -- the more human meaning being "the first Friday of the month" Notice that we use the 3-letter "Fri" for Friday; this is another addition to the days field. We can use 3-letter abbreviations in either a range or as a condition, but NEVER BOTH: OK: Mon-Fri (every weekday) Sat-Sun (only on the weekends) 8-15&Mon (the second Monday of the month) 1-3!Mon-Fri (the first 3 days of the month, as long as not Mon-Fri) 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31 (every other day) NOT OK: OK: Mon-Fri!Tue Mon,Wed-Fri Sat&Sun Sat-Sun EXAMPLES: Remember: - Whitespace (space, tab, newline) - delimited fields SECOND MINUTE HOUR DAY MONTH * * * * * (every second) 0,30 * * * * (every 30 seconds) 0 0,10,20,30,40,50 * * * (every 10 minutes) 0 0 * * * (beginning of every hour) 0 0 0,5,11,17 * * (at midnight, 6am, noon, 6pm) fin.