Perl module for scheduled jobs - bit like cron
I started to write a module for scheduling perl jobs with more readable syntax than a cron job, but wondered if there was already one available.
开发者_开发百科I'm after something that can be run from a perl script, not a crontab file. This syntax has got to be easily readable. For example :-
every Monday morning
every other Tuesday at 3:30pm
every night
once only on 14th August 2010 at 2pm
..if there was something even remotely similar to that it would be great. I had a quick look on CPAN but couldn't find what I was after.
It looks like DateTime::Format::Natural at CPAN does this. Unfortunately the documentation barely exists. Culling from the module self-test files I find:
{ '9 in the evening' => '24.11.2006 21:00:00' },
{ 'monday 6 in the morning' => '20.11.2006 06:00:00' },
{ 'monday 4 in the afternoon' => '20.11.2006 16:00:00' },
{ 'monday 9 in the evening' => '20.11.2006 21:00:00' },
{ 'last sunday at 21:45' => '19.11.2006 21:45:00' },
{ 'monday last week' => '13.11.2006 00:00:00' },
{ '6th day last week' => '18.11.2006 00:00:00' },
{ '6th day this week' => '25.11.2006 00:00:00' },
{ '6th day next week' => '02.12.2006 00:00:00' },
{ '12th day last month' => '12.10.2006 00:00:00' },
{ '12th day this month' => '12.11.2006 00:00:00' },
{ '12th day next month' => '12.12.2006 00:00:00' },
{ '1st day last year' => '01.01.2005 00:00:00' },
{ '1st day this year' => '01.01.2006 00:00:00' },
{ '1st day next year' => '01.01.2007 00:00:00' },
which looks promising.
Schedule::Cron does what you're looking for.
精彩评论