cron job syntax php Parser und Berechner
Autor: Ingmar Pforr
eingetragen: Montag, 16. Januar 2012 um 17:50 Uhr (3/2012 Kalenderwoche)
geändert: Montag, 16. Januar 2012 um 17:56 Uhr (3/2012 Kalenderwoche)
Keywords: cron job syntax parser
Kategorien: PHP-ZF, Linux, PHP,
Text:
Man möchte Jobs anlegen und abfragen in gleicher Syntax wie Linux cron etc.
Voraussetzung: cron job der oft (alle 5 Minuten) ein steuerndes Eltern-Script aufruft.
Die etablierte Syntax von cron soll verwendet werden.
Job soll z.B. alle 15 Minuten ausgeführt werden
M S T M W
*/5 * * * *
Job soll z.B. einmal pro Woche sonntags um 23:59 Uhr ausgeführt werden:
M S T M W
59 23 * * 0
Diesen String will man übergeben und auswerten gegen die aktuelle Systemzeit etc.
Marktcheck:
sehr interessant, aber PHP 5.3
https://github.com/mtdowling/cron-expression#readme
Umbau auf PHP 5.2.x möglich, schätze 1-2 PT
siehe Quelle 1
+Validierung!
+Unit Test!
3 Projekte auf PHP Classes:
http://www.phpclasses.org/package/2568-PHP-Parse-cron-tab-files-to...
http://www.phpclasses.org/package/1189-PHP-Schedule-cron-jobs-with...
http://www.phpclasses.org/package/1985-PHP-Manipulate-cron-tab-fil...
Primärquellen:
1. http://stackoverflow.com/questions/321494/calculate-when-a-cron-jo...
2. http://stackoverflow.com/questions/235504/validating-crontab-entri...
3. http://stackoverflow.com/questions/3016819/do-you-know-any-library...