跳到主要内容
uencoder

Use cron expressions 为 scheduling

Cron expressions 定义 recurring schedules 具有 5 fields: minute, hour, day, month, weekday. Learn syntax, 特殊 characters, 和常见 patterns.

  1. 1

    Cron syntax: minute hour day-of-month month day-of-week. 每个字段 accepts: * (任何), 特定值 (5), 范围 (1-5), 列表 (1,3,5), 步骤 (*/15 或 1-30/5). Examples: "0 9 * * 1-5" (9 AM 开 weekdays), "*/15 * * * *" (每个 15 minutes), "0 0 1 * *" (midnight 开 1st 的每个 month). Day 的 week: 0=Sunday, 7=Sunday, 1-6=Monday-Saturday.

  2. 2
    Cron 表达式生成器 →

    生成 a cron expression from a human-readable description. Specify the schedule (e.g., "every weekday at 9 AM") and the tool produces the cron expression. This avoids syntax errors and helps learn cron syntax.

  3. 3
    Cron 表达式解析器 →

    解析 a cron expression and show the human-readable description, next execution times, and any syntax errors. This is useful for verifying cron expressions before deployment. The parser handles standard cron, Quartz (with seconds and years), and extended syntax (@daily, @weekly).

  4. 4
    sql-format → word-count

    While 此 workflow 是为 SQL, concept 的 formatting 和 documenting applies 到 cron expressions too. Document 你的 cron 作业: 什么它们 , 当它们运行, expected 时长, 和告警. Store cron expressions 在 version control 具有文档.

常见问题

什么是 差集之间 cron 和 Quartz?
标准 cron 有 5 fields (minute, hour, day, month, weekday). Quartz 有 6-7 fields (第二, minute, hour, day, month, weekday, year). Quartz supports 最后 day 的 month (L), nth weekday (#), 和更多. Use 标准 cron 为系统 crontab; use Quartz 为 Java schedulers (Spring, Quartz). 最多 cloud schedulers use 标准 cron.
如何 I 处理 timezone 为 cron 作业?
System cron runs 在服务器's timezone. 为 timezone-aware scheduling, use: (1) AWS EventBridge (supports timezone per 规则), (2) Kubernetes CronJob (supports timeZone 字段在 1.25+), (3) 调度器库 (节点-cron 具有 timeZone 选项). Store 调度在 UTC 和转换为 display, 或 use 目标 timezone explicitly. 是 aware 的 DST — 9 AM 作业可以 shift 到 8 AM 或 10 AM 期间 DST transitions.

解决此任务的工作流

相关工具