Cron Expression for "每周日凌晨执行"

0 0 0 * * 0

Runs every Sunday at 00:00:00, ideal for weekend maintenance

Format: Spring

Cron Expression Generator

A professional cron expression generator supporting Linux Crontab, Quartz, and Spring formats. Visually configure seconds, minutes, hours, days, months, and weekdays with real-time preview of next execution times.

AI Magic Input
Runs every Sunday at 00:00:00, ideal for weekend maintenance
Sec Min Hour Day Month Week
🎛️

Field Configuration

📋

Templates

📊

Result

Rule
0Sec, 0Min, 0Hour, Every day, Every month, Sun
Next 5 runs
Sun, 02/01, 12:00 AM
Sun, 02/08, 12:00 AM
Sun, 02/15, 12:00 AM
Sun, 02/22, 12:00 AM
Sun, 03/01, 12:00 AM
💻

Export Code

0 0 0 * * 0
📖

Linux Crontab vs Quartz vs Spring Cron Syntax

LinuxQuartzSpring
FormatM H D M WS M H D M WS M H D M W
Second
?
L/W/#

Technical Description

Cron Expression Generator is a visual configuration tool designed for backend developers and system operations engineers. It supports multiple standards including Quartz, Linux Crontab, and Spring framework. By abstracting complex wildcards (such as * / ? L W) into intuitive UI components, this tool reduces the probability of generation errors to zero. The backend logic uses rigorous timeline simulation algorithms to predict the next five specific execution time points in real-time.

Use Cases

Essential for DevOps engineers setting up scheduled tasks, backend developers configuring Spring/Quartz schedulers, system administrators managing crontab jobs, and anyone needing to create or debug timed job expressions. Useful for setting up backup schedules, report generation, data synchronization, and automated maintenance tasks.

User Guide

  1. 1
    Select FrequencyChoose "Every second", "Every minute", "Daily" or "Custom" from the menu.
  2. 2
    Visual SelectionUse checkboxes or sliders to select specific execution cycles (e.g., Monday to Friday at 2 AM).
  3. 3
    Real-time PreviewThe Cron string matching the format is dynamically generated below, showing "Next execution time".
  4. 4
    Copy CodeOne-click copy to your configuration file or Java/Python code.

Common Cron Expression Examples

Quick reference for cron expression in common scheduling scenarios. Covers formats for Linux Crontab, Spring @Scheduled, and Quartz. Click any expression to copy instantly — paste directly into Jenkins, Spring Boot, or Linux crontab config files.

ScheduleLinux CrontabSpring CronQuartzUse Case
Every minute* * * * *0 * * * * *0 * * * * ?For real-time monitoring, heartbeat detection
Every 5 minutes*/5 * * * *0 */5 * * * *0 0/5 * * * ?For data sync, cache refresh
Every 10 minutes*/10 * * * *0 */10 * * * *0 0/10 * * * ?For log collection, status reporting
Every 30 minutes*/30 * * * *0 */30 * * * *0 0/30 * * * ?For periodic aggregation, report generation
Every hour0 * * * *0 0 * * * *0 0 * * * ?For data backup, analytics
Daily at midnight0 0 * * *0 0 0 * * *0 0 0 * * ?For log cleanup, data archiving
Daily at 3am0 3 * * *0 0 3 * * *0 0 3 * * ?For off-peak batch processing
Daily at 8am0 8 * * *0 0 8 * * *0 0 8 * * ?For daily reminders, report delivery
Weekdays at 9am0 9 * * 1-50 0 9 * * 1-50 0 9 ? * 2-6For business day tasks
Every Monday at midnight0 0 * * 10 0 0 * * 10 0 0 ? * 2For weekly reports, data aggregation
1st of every month0 0 1 * *0 0 0 1 * *0 0 0 1 * ?For monthly billing, settlements
Last day of month0 0 28-31 * *0 0 0 L * *0 0 0 L * ?For month-end summary (L only in Quartz)

Quick Reference by Use Case

Cron Expression for Every 5 Minutes

0 */5 * * * ?

For data sync, cache refresh

cron every 5 minutes

Daily Backup Task at 2 AM

0 0 2 * * ?

For database backup, log archiving

cron 2am daily

Weekly Report Task Every Monday at 9 AM

0 0 9 ? * 2

For weekly reports, data aggregation

cron every monday

Weekday Tasks (Monday to Friday)

0 0 9 ? * 2-6

For business day reminders, reports

cron weekdays only

Monthly Settlement on the 1st

0 0 0 1 * ?

For billing, monthly statistics

cron first day of month

Hourly Status Check Task

0 0 * * * ?

For health checks, monitoring

cron every hour

Architect's Notes: Best Practices for Java/Kotlin Cron Jobs

⚠️ The "Every Second" Trap in Spring Boot

Be careful when generating 6-field expressions like * * * * * * (every second). By default, Spring's @Scheduled runs on a single-threaded TaskScheduler. If your task takes 1.5 seconds to execute but is scheduled every 1 second, the queue will back up, potentially blocking other scheduled tasks in your application. Solution: Configure a thread pool or use @Async for long-running tasks.

☕ Kotlin & Spring: The Syntax Sugar

When using Kotlin with Spring Boot, you don't need to wrap your scheduled functions in a class if you use top-level functions, but standard Spring beans require the function to be inside a @Component class. Also, consider using runBlocking if you need to call suspend functions from a synchronous @Scheduled trigger.

🔄 Linux Crontab vs. Spring Cron vs. Quartz

  • Linux: 5 fields (Minute, Hour, Day, Month, Week). No seconds.
  • Spring (@Scheduled): 6 fields. Adds Seconds at the beginning.
  • Quartz: 6-7 fields. Adds Year (optional) at the end, and supports distinct logic for ? vs * in Day-of-Week.

Tip: Our tool automatically handles the conversion. Switch the tabs above to see the difference.

Frequently Asked Questions

How to edit Linux crontab?

Run crontab -e in your terminal. This opens the default editor (usually Vim or Nano) to edit your cron jobs. First-time users may be prompted to select an editor.

How to exit Vim after crontab -e?

Press Esc to exit edit mode, type :wq (write and quit) or :q! (quit without saving), then hit Enter. This is one of the most common issues for Linux beginners.

How to list or remove all cron jobs?

Use crontab -l to list all cron jobs for the current user. Use crontab -r to remove all jobs (Warning: this cannot be undone, use with caution).

What are the differences between Linux Crontab, Spring Cron, and Quartz Cron?

Linux Crontab uses a 5-field format (minute hour day month weekday) without second-level scheduling; Spring Cron uses 6 fields (second minute hour day month weekday), supports seconds but not ? or L/W characters; Quartz Cron also uses 6 fields with the most features, supporting ?, L, W, # special characters for complex enterprise scheduling scenarios.

How to convert Linux Crontab expression to Spring Cron format?

Simply add a second field at the beginning of the Linux Crontab expression. For example, Linux "0 8 * * *" (daily at 8am) becomes "0 0 8 * * *" in Spring format (adding "0 " at the start means execute at second 0).

What is the difference between ? and * in Quartz Cron?

In Quartz, * means "every", while ? means "no specific value". Since "day" and "weekday" fields may conflict (e.g., 15th of month vs every Monday), Quartz requires one of them to use ?. For example, "0 0 8 15 * ?" means 8am on the 15th of every month, with weekday ignored using ?.

What Cron format does Spring Boot @Scheduled annotation use?

Spring Boot's @Scheduled annotation uses Spring Cron format (6 fields: second minute hour day month weekday). For example, @Scheduled(cron = "0 0 8 * * *") runs every day at 8am. Note that Spring Cron doesn't support year field or some Quartz special characters.

How to create a Cron expression for every 5 minutes?

Linux Crontab: */5 * * * *; Spring Cron: 0 */5 * * * *; Quartz: 0 0/5 * * * ?. All three represent every 5 minutes execution with slightly different syntax.

Can generated expressions be used directly in Linux Crontab?

Yes. Expressions generated in "Linux Crontab" mode are fully compatible with all major Linux distributions (Ubuntu, CentOS, Debian, etc.). Simply copy and paste into crontab -e editor.

What Cron expression format does Jenkins Pipeline support?

Jenkins uses the standard 5-field Linux Crontab format (minute hour day month weekday), configured in Jenkinsfile via triggers { cron("0 8 * * 1-5") }. Jenkins also supports the H symbol for load balancing, e.g., H/15 * * * * means every 15 minutes but with randomized start times.

How to fix Spring @Scheduled error "Cron expression must consist of 6 fields"?

This error indicates you're using a 5-field Linux format instead of the 6-field Spring format. Spring Cron requires a seconds field. Solution: Add a seconds field at the beginning, e.g., change "0 8 * * *" to "0 0 8 * * *" (first 0 represents seconds).

How to fix Quartz error "Support for specifying both a day-of-week AND a day-of-month parameter is not implemented"?

Quartz doesn't allow specifying concrete values for both "day" and "weekday" fields simultaneously - one must be set to ?. For example, to run on the 15th of each month, write "0 0 8 15 * ?" instead of "0 0 8 15 * *". Change the weekday field to ? to resolve this.

How to set Cron expression for weekends only (Saturday and Sunday)?

Linux Crontab: 0 9 * * 0,6 (Sunday=0, Saturday=6); Spring Cron: 0 0 9 * * 0,6; Quartz: 0 0 9 ? * 1,7 (Quartz Sunday=1, Saturday=7). Note that different formats use different numbering for weekdays.

How to run Cron job on the last day of every month?

Linux Crontab doesn't directly support "last day" syntax - use script logic or approximate with "0 0 28-31 * *". Spring Cron supports L character: 0 0 0 L * *. Quartz also supports: 0 0 0 L * ?. Recommend using Quartz or Spring Cron for such complex requirements.

How to run a task every 30 seconds?

Linux Crontab minimum granularity is minutes, doesn't support seconds. Spring Cron uses "0,30 * * * * *" to run at second 0 and 30 of every minute. Quartz format is the same: 0,30 * * * * ?. For more precise sub-second control, consider using ScheduledExecutorService instead.

Linux Crontab Syntax & Cheat Sheet

Common operations: editing crontab, exiting Vim, and more

How to edit crontab?
crontab -eRun crontab -e in terminalDefault editor is usually Vim or Nano
How to exit Vim editor?
:wqPress Esc, type :wq, hit Enter:wq means write and quit, :q! means quit without saving
How to list or remove jobs?
crontab -lcrontab -l to list, crontab -r to remove allWarning: crontab -r removes all jobs and cannot be undone

Cron 5-Field Format (Linux)

Minute0-59*/5
Hour0-238
Day1-311
Month1-12*
Weekday0-61-5

Note: Linux crontab uses 5 fields. Spring/Quartz uses 6 fields (adds "seconds" at the beginning)

Popular Cron Scenarios

Click any scenario below to instantly generate the cron expression with AI.

Every Sunday Cron Expression: 0 0 0 * * 0 | Generator | YYTools.cc