站点名称:Cron Translator: Read 0 9 * * 1-5 Without Guessing
所属分类:全栈极客与开发辅助
相关标签: # cron # crontab # scheduler # devtools
官方网址:https://www.9314.cn/tools/cron-translator/en/
进入网站站点介绍

0 0 1 * 1 is not "the 1st if it is a Monday". It is "the 1st, or any Monday".2 AM, the report never ran. The log was empty, not even an error, which means the job never started.
One asterisk was missing. Four fields instead of five. Linux said nothing, the job did nothing, and it sat there quietly for three days.
That is cron's temperament: it does not complain, it just does not run.
Standard crontab takes five fields: minute, hour, day of month, month, day of week. Linux, macOS and most cloud schedulers follow it.
Quartz and Spring take six, with a seconds field in front. Paste six into a Linux crontab and it is a syntax error. Paste five into Spring and it reads the first value as seconds, shifting everything one column.
Copy from where it runs. That sentence saves half your debugging time.
This is the one that bites. People read 0 0 1 * 1 as "the 1st, and only when it falls on a Monday", meaning the first Monday of the month.
It actually means "the 1st, or any Monday". That fires four or five times a month. You think you are hunting a bug; you are reading the spec backwards.
Standard cron cannot express "first Monday of the month". Check the date inside the script, or move to Quartz # syntax. Do not improvise a range, it only gets wider.
A syntax table never sticks. "The next five runs are these five timestamps" sticks immediately.
The page does three things: translates on paste, explains what every field controls, and lists the next five runs in your device timezone. Each row also shows the UTC time, so when your server logs in UTC you compare directly instead of doing eight-hour arithmetic in your head.
When a schedule can never fire, February 30th for instance, it says so instead of pretending.
Describe the schedule in plain English: every weekday at 8:30 am becomes 30 8 * * 1-5. Chinese works too.
Then the same page explains what you just generated, so you can confirm it before it reaches the crontab.
My expression has 6 fields with seconds. Can I paste it? Yes. Quartz and Spring prepend a seconds field, so the page drops it and evaluates the remaining five, with a note to confirm which platform you target. Going the other way, pasting six fields into a Linux crontab is a syntax error.
The times here are 8 hours off from my server logs. This page uses your device timezone, and most servers run UTC. Every run row shows the UTC time too, so compare that against the log. An eight-hour gap is timezone, not a broken expression.
How do I schedule the first Monday of the month? Standard cron cannot express it. 0 9 1-7 * 1 reads as the 1st through the 7th, or any Monday, which is wider than you want. Check the date inside the script, or switch to Quartz # syntax.
Does this page keep my expression? No. Everything runs in your browser, no request is sent, nothing is logged, and a refresh clears it. Cron lines often carry paths and account names, so nothing leaves the tab.
中文版:https://www.9314.cn/tools/cron-translator/
浏览统计(最近30天)
评论列表 (0条)