Complete list
| Macro | Equivalent expression | Meaning |
|---|---|---|
@yearly | 0 0 1 1 * | Once a year, January 1 at midnight |
@annually | 0 0 1 1 * | Same as @yearly |
@monthly | 0 0 1 * * | 1st of every month at midnight |
@weekly | 0 0 * * 0 | Sunday at midnight |
@daily | 0 0 * * * | Every day at midnight |
@midnight | 0 0 * * * | Same as @daily |
@hourly | 0 * * * * | Top of every hour |
@reboot | (no expansion) | Once at system startup |
Platform support
| Platform | Standard macros | @reboot |
|---|---|---|
| Vixie cron (most Linux) | ✓ | ✓ |
| cronie (RHEL/CentOS/Fedora) | ✓ | ✓ |
| BSD cron | ✓ | ✗ (usually) |
| Spring @Scheduled | ✓ (some) | ✗ |
| Quartz | ✗ | ✗ |
| AWS EventBridge | ✗ | ✗ |
| GitHub Actions | ✗ | ✗ |
| Kubernetes CronJob | ✗ | ✗ |
| Jenkins | ✓ | ✗ |
If you're not sure, use the explicit form. 0 0 * * * works everywhere; @daily doesn't.
The @reboot quirk
@reboot fires once at system startup. It's useful for starting long-running processes that aren't real services:
@reboot /usr/local/bin/start-my-tunnel.sh
Caveats:
- Only available on Vixie cron and cronie — NOT on BSD or most container cron implementations
- Fires AFTER cron starts, which may be later than you expect — typically after multi-user.target on systemd, so all standard services are up
- For better startup ordering, use a real systemd service unit instead
Spring's macro support (limited)
Spring's @Scheduled cron parser accepts most macros but treats them slightly differently:
@Scheduled(cron = "@daily") // Works @Scheduled(cron = "@hourly") // Works @Scheduled(cron = "@reboot") // Does NOT work @Scheduled(cron = "@annually") // May not work — use @yearly
When in doubt, use the explicit 6-field form: @Scheduled(cron = "0 0 0 * * *") for daily.
Why not just always use macros?
Three reasons to prefer explicit expressions over macros:
- Portability. Explicit expressions work on every cron implementation
- Flexibility. Macros are fixed times;
0 0 * * *is easy to modify to0 3 * * * - Off-peak scheduling.
@dailymeans midnight UTC, which is the most contested moment of the day for cloud servers. Pick something like13 3 * * *instead to avoid stampedes