从0分钟以外的时间开始,如何每5分钟执行一次cron作业?

编程入门 行业动态 更新时间:2024-10-14 14:14:34
本文介绍了从0分钟以外的时间开始,如何每5分钟执行一次cron作业?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想让脚本每5分钟运行一次,比如说从13:02开始运行,这样我可以让每5分钟运行另一个脚本,但是从13:04开始运行,因此第二个脚本在第一个脚本开始运行两分钟后运行工作。我该如何实现?

I would like to have a script run every 5 minutes let's say starting from 13:02 so I can have another script runs every 5 minutes but starting from 13:04 so the second script runs two minutes after the start of the first job. How can I achieve this?

推荐答案

使用此方法:

*/5+2 * * * * 1st-script */5+4 * * * * 2nd-script

供将来参考,请在线查看此 Cron Job Generator 。

For future reference take a look at this online Cron Job Generator.

由于有一些报告称 + 语法在Ubuntu上不起作用14.04,这是一个变化形式:

Since there are several reports that the + syntax is not working on Ubuntu 14.04, here's a variation:

2-59/5 * * * * 1st-script 4-59/5 * * * * 2nd-script

这将导致第一个脚本每5分钟运行一次,偏移量为2分钟每个小时的开始,第二个脚本的行为相同,但偏移量为4分钟。

This will result in the 1st script to run every 5 minutes starting with an offset of 2 minutes at the beginning of each hour and the 2nd script to behave the same with an offset of 4 minutes.

更多推荐

从0分钟以外的时间开始,如何每5分钟执行一次cron作业?

本文发布于:2023-11-25 04:51:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1628409.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:作业   时间   cron

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!