Cron · @reboot, @yearly, @annually, @monthly, @weekly, @daily, @midnight, @hourly
Cron special strings
Macros such as @daily and @reboot replace common five-field schedules in Vixie-style cron.
Key facts
| Macros | @reboot, @yearly, @annually, @monthly, @weekly, @daily, @midnight, @hourly |
|---|---|
| @daily | <code>0 0 * * *</code> |
| @midnight | Same as @daily |
| @hourly | <code>0 * * * *</code> |
| @weekly | <code>0 0 * * 0</code> |
| @monthly | <code>0 0 1 * *</code> |
| @yearly | <code>0 0 1 1 *</code> |
| @reboot | At cron daemon start, not on a clock schedule |
| Support | Vixie cron and cronie; not part of POSIX |
Short and unambiguous
Macros make intent obvious where the five-field equivalent is easy to misread. @daily is midnight in the daemon's time zone; @weekly is midnight between Saturday and Sunday because day 0 is Sunday. @yearly and @annually are aliases.
@reboot is different in kind: it has no schedule and runs once when the daemon starts, which on a laptop may be several times a day and on a server may be months apart. It does not wait for the network or for other services.
Portability and failure modes
Some cron implementations, minimal container crons and a few hosted schedulers do not accept macros. When the schedule is deployed as a file, a comment with the expanded five-field form keeps it readable and portable.
A @reboot job that needs the network should retry inside the command rather than assume connectivity; the daemon can start before DNS or a database is reachable. Likewise, a macro scheduled at midnight runs in the system time zone, which in a container is often UTC.
Frequently asked questions
What is @daily in cron?
It is 0 0 * * * — midnight every day in the daemon's local time zone.
When does @reboot run?
When the cron daemon starts, not at boot time in the operating-system sense. Services it depends on may not be ready.
Are @macros standard?
They are a Vixie cron extension adopted by cronie and many others, but they are not part of POSIX.