代码之家  ›  专栏  ›  技术社区  ›  dalton

用于计划作业的Perl模块-有点像cron

  •  0
  • dalton  · 技术社区  · 14 年前

    我开始编写一个模块,用比cron作业更可读的语法来调度Perl作业,但我想知道是否已经有一个可用的模块了。

    我在寻找可以从Perl脚本运行的东西,而不是crontab文件。这种语法必须易于阅读。例如:

    every Monday morning
    every other Tuesday at 3:30pm
    every night
    once only on 14th August 2010 at 2pm
    

    …如果有什么东西,甚至是远程类似,那将是伟大的。我看了一下CPAN,但找不到我想要的东西。

    2 回复  |  直到 14 年前
        1
  •  2
  •   msw    14 年前

    看起来像 DateTime::Format::Natural 在CPAN做这个。不幸的是,文档几乎不存在。从我发现的模块自检文件中剔除:

    { '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' },
    

    看起来很有希望。

        2
  •  1
  •   Ether    14 年前

    Schedule::Cron 做你想要的。