Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hybris运行cron作业';x';月底前天_Cron_Hybris - Fatal编程技术网

Hybris运行cron作业';x';月底前天

Hybris运行cron作业';x';月底前天,cron,hybris,Cron,Hybris,我想在Hybris中创建一个cron作业,它可以在月底前5天运行 0 23 22-31**[$(日期-d+1天+%d)-等式1] 在hybris cron作业impex配置中与此等效的是什么 hybris使用石英2,如图所示 从石英2: “L”字符可用于月日和周日字段。这个字符是“last”的缩写,但在这两个字段中有不同的含义。例如,月日字段中的值“L”表示“月的最后一天”-非闰年的1月31日,2月28日。[…]您还可以指定与月的最后一天的偏移量,例如“L-3”,表示日历月的第三天到最后一天。使

我想在Hybris中创建一个cron作业,它可以在月底前5天运行

0 23 22-31**[$(日期-d+1天+%d)-等式1]


在hybris cron作业impex配置中与此等效的是什么

hybris使用石英2,如图所示

从石英2:

“L”字符可用于月日和周日字段。这个字符是“last”的缩写,但在这两个字段中有不同的含义。例如,月日字段中的值“L”表示“月的最后一天”-非闰年的1月31日,2月28日。[…]您还可以指定与月的最后一天的偏移量,例如“L-3”,表示日历月的第三天到最后一天。使用“L”选项时,不要指定列表或值的范围,这一点很重要,因为您会得到令人困惑/意外的结果

所以您可以使用
0 L-5*?


注意:在较旧的hybris版本(v4)上,我不确定Quartz 2是否可用。石英1不能使用
L-x
模式。 如果您希望在月底前5天创建3个触发器

0 0 20 26 1,3,5,7,8,10,12 ? * -> the 26th at 20h for all 31 days month

0 0 20 25 4,6,9,11 ? *  -> the 25th at 20h for all 30 days month

0 0 20 23 2 ? * -> the 23rd at 20h for february, this is actually a corner case because you may have different day for february...

还有另一个解决方案,但要复杂得多


您可以在第一次需要运行时设置触发器。然后在作业中,您可以访问LocaleDate对象以确定下一次触发作业的时间。最后用Java代码或impex creation+import更新cronjob的触发器。

我找到了更好的解决方案,使用quartz

0 0 0 L-5 * ? *