Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.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
cron如何处理;“天”;领域_Cron - Fatal编程技术网

cron如何处理;“天”;领域

cron如何处理;“天”;领域,cron,Cron,我正在尝试使用创建一个动态任务调度程序 cron如何处理月份天数溢出的天数?例如,现在是2月,有29天。cron将如何处理day表达式31或*/2 如果将*/2扩展为1,3,5..29,31,我可以看到31被删除。但如果一天仅仅是31天,那就不太好了。有什么想法吗?我相信如果不匹配,cron就会忽略它。手册页的编写方式表明,如果月日匹配或周日匹配,则手册页匹配。一些实现(例如)只是将DoM中的*/2计算为1,3,5,7..31,因此它必须在2月份忽略31。它将忽略它,因为它只使用一个简单的匹配。

我正在尝试使用创建一个动态任务调度程序

cron如何处理月份天数溢出的天数?例如,现在是2月,有29天。cron将如何处理day表达式
31
*/2


如果将
*/2
扩展为
1,3,5..29,31
,我可以看到31被删除。但如果一天仅仅是31天,那就不太好了。有什么想法吗?

我相信如果不匹配,cron就会忽略它。手册页的编写方式表明,如果月日匹配或周日匹配,则手册页匹配。一些实现(例如)只是将DoM中的*/2计算为1,3,5,7..31,因此它必须在2月份忽略31。

它将忽略它,因为它只使用一个简单的匹配。您可能正在尝试实现“每个月的最后一天运行此”。像这样的东西应该有用(找到了):


所以
**31**
只能在每年7个月运行?是的,只能在有31天的月份运行。所以
**31**
只能在每年7个月运行?
59 23 * * * [ `date -d tomorrow +%d` -eq '01' ] && <your script>
TODAY=`date +%d`
TOMORROW=`date +%d -d "1 day"`

# If tomorrow date is less than today, we are at the end of the month
if  [  $TOMORROW  -lt  $TODAY  ];  then
  # This is the last day of the month, so you can do your stuff here...run other script...
fi