How can I run a cron job every 15 mins on Jenkins?
我怎么能在詹金斯身上每15分钟做一次cron呢?
This is what I've tried :
这就是我所尝试的:
On Jenkins I have a job set to run every 15 mins using this cron syntax :
在Jenkins上,我有一个作业集,使用cron语法每15分钟运行一次:
14 * * * *
But the job executes every hour instead of 15 mins.
但是这个工作每小时执行一次,而不是15分钟。
I'm receiving a warning about the format of the cron syntax :
我收到关于cron语法格式的警告:
Spread load evenly by using ‘H * * * *’ rather than ‘14 * * * *’
Could this be the reason why the cron job executes every hour instead of 15 mins ?
这可能是cron任务每小时执行一次而不是每15分钟的原因吗?
3 个解决方案
#1
68
Your syntax is slightly wrong. Say:
你的语法有点错误。说:
*/15 * * * * command
|
|--> `*/15` would imply every 15 minutes.
*
indicates that the cron expression matches for all values of the field.
*表示cron表达式匹配字段的所有值。
/
describes increments of ranges.
/描述范围的增量。
#2
55
1) Your cron is wrong. If you want to run job every 15 mins on Jenkins use this:
你的cron是错的。如果你想在Jenkins上每15分钟运行一次作业,请使用以下方法:
H/15 * * * *
2) Warning from Jenkins Spread load evenly by using ‘...’ rather than ‘...’
came with JENKINS-17311:
2)詹金斯的警告使用“……”“而不是”……”带着詹金斯- 17311:
To allow periodically scheduled tasks to produce even load on the system, the symbol H (for “hash”) should be used wherever possible. For example, using 0 0 * * * for a dozen daily jobs will cause a large spike at midnight. In contrast, using H H * * * would still execute each job once a day, but not all at the same time, better using limited resources.
为了允许定期安排的任务在系统上产生均匀的负载,应该尽可能使用符号H(“hash”)。例如,在12个日常工作中使用0 * * *会在午夜导致一个大高峰。相比之下,使用H * * * * *仍然每天执行一次任务,但不是同时执行所有任务,更好地使用有限的资源。
Examples:
例子:
-
H/15 * * * *
- every fifteen minutes (perhaps at :07, :22, :37, :52): - H/15 * * * * -每十五分钟(可能在:07,:22,:37,:52):
-
H(0-29)/10 * * * *
- every ten minutes in the first half of every hour (three times, perhaps at :04, :14, :24) - H(0-29)/10 * * * * *——每小时的前半段每10分钟(3次,可能在:04,:14,:24)
-
H 9-16/2 * * 1-5
- once every two hours every weekday (perhaps at 10:38 AM, 12:38 PM, 2:38 PM, 4:38 PM) - H 9-16/2 * 1-5 -每两个小时一次(可能在上午10:38,12:38,2:38,4:38)
-
H H 1,15 1-11 *
- once a day on the 1st and 15th of every month except December - H 1,15 1-11 * -除了12月以外,每个月的1号和15号每天一次
#3
10
It should be,
它应该是,
*/15 * * * * your_command_or_whatever
#1
68
Your syntax is slightly wrong. Say:
你的语法有点错误。说:
*/15 * * * * command
|
|--> `*/15` would imply every 15 minutes.
*
indicates that the cron expression matches for all values of the field.
*表示cron表达式匹配字段的所有值。
/
describes increments of ranges.
/描述范围的增量。
#2
55
1) Your cron is wrong. If you want to run job every 15 mins on Jenkins use this:
你的cron是错的。如果你想在Jenkins上每15分钟运行一次作业,请使用以下方法:
H/15 * * * *
2) Warning from Jenkins Spread load evenly by using ‘...’ rather than ‘...’
came with JENKINS-17311:
2)詹金斯的警告使用“……”“而不是”……”带着詹金斯- 17311:
To allow periodically scheduled tasks to produce even load on the system, the symbol H (for “hash”) should be used wherever possible. For example, using 0 0 * * * for a dozen daily jobs will cause a large spike at midnight. In contrast, using H H * * * would still execute each job once a day, but not all at the same time, better using limited resources.
为了允许定期安排的任务在系统上产生均匀的负载,应该尽可能使用符号H(“hash”)。例如,在12个日常工作中使用0 * * *会在午夜导致一个大高峰。相比之下,使用H * * * * *仍然每天执行一次任务,但不是同时执行所有任务,更好地使用有限的资源。
Examples:
例子:
-
H/15 * * * *
- every fifteen minutes (perhaps at :07, :22, :37, :52): - H/15 * * * * -每十五分钟(可能在:07,:22,:37,:52):
-
H(0-29)/10 * * * *
- every ten minutes in the first half of every hour (three times, perhaps at :04, :14, :24) - H(0-29)/10 * * * * *——每小时的前半段每10分钟(3次,可能在:04,:14,:24)
-
H 9-16/2 * * 1-5
- once every two hours every weekday (perhaps at 10:38 AM, 12:38 PM, 2:38 PM, 4:38 PM) - H 9-16/2 * 1-5 -每两个小时一次(可能在上午10:38,12:38,2:38,4:38)
-
H H 1,15 1-11 *
- once a day on the 1st and 15th of every month except December - H 1,15 1-11 * -除了12月以外,每个月的1号和15号每天一次
#3
10
It should be,
它应该是,
*/15 * * * * your_command_or_whatever