我开始编写一个用于调度perl作业的模块,其语法比cron作业更可读,但是想知道是否已有一个可用。
我正在处理可以从perl脚本运行的东西,而不是crontab文件。这种语法必须易于阅读。例如: -
every Monday morning
every other Tuesday at 3:30pm
every night
once only on 14th August 2010 at 2pm
..如果有一些东西甚至远远类似于那将是伟大的。我快速浏览了CPAN,但找不到我想要的东西。
答案 0 :(得分:2)
看起来CPAN的DateTime::Format::Natural就是这样做的。不幸的是,文档几乎不存在。从模块自检文件中剔除我发现:
{ '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' },
看起来很有希望。
答案 1 :(得分:1)
Schedule::Cron可以满足您的需求。