Joost Brugman is a freelance project manager and web developer based in Amsterdam, The Netherlands.
He is also promotor for green energy, an avid supporter of microfinancing, a world traveller and he was the co-founder of "Improphecy", one of Amsterdam's premier improvised comedy shows but gave up performing himself in 2008 to persue other dreams.
Or to any other language
Cron on UNIX certainly is a powerful tool for scheduling tasks. However, its configuration (the crontab entries) was certainly not designed to be pleasantly readable to humans. For the development of the StreamlineFoundation plugin I was looking for a way to convert any crontab entry into human readable form but I could not find anybody who had done it. So, I made it and here it is, with multilanguage support:
Presently you can provide any standard cron specification which includes:
There is presently no support for the ? wildcard, but providing a * is equal to my knowledge even though strictly speaking * constitutes a value and ? constitutes NULL. I have omitted special characters such as L and W since I could find no documentation that was sufficiently specific and - besides - I could not find those characters in the UNIX man pages at all anyway.
The code behind this is packed in a PHP class that accepts a cron specification to set up a schedule. All you need to do then, is call the necessary function to get the cron specification in the natural language of your choice:
$cron = ns\Schedule::fromCronString('* * * * * *', 'en'); $cron->asNaturalLanguage();
It also has a couple of really nice features such as moving back and forth through the scheduled points in time by calling ->next() and ->previous(). These functions return a UNIX timestamp, an ISO formatted datetime string (YYYY-MM-DD HH:II:SS) or a 5-element array with the date and time components in integer format.
Keep an eye out. I expect to release the initial release of Streamline, and the StreamlineFoundation plugin, including this class, in spring 2012. If you wish to use it in the meantime, drop me a note.