NAME¶
systemd.cron - systemd cron units
SYNOPSIS¶
cron.target, cron-boot.timer, cron-hourly.timer, cron-daily.timer,
cron-weekly.timer, cron-monthly.timer, cron-yearly.timer, cron-boot.target,
cron-hourly.target, cron-daily.target, cron-weekly.target,
cron-monthly.target, cron-yearly.target, cron-boot.service,
cron-hourly.service, cron-daily.service, cron-weekly.service,
cron-monthly.service, cron-yearly.service
DESCRIPTION¶
These units provide cron daemon functionality by running scripts in cron
directories. The crontabs are automaticaly translated by
systemd-crontab-generator(1) .
FILES¶
- /etc/cron.boot
- Directory for scripts to be executed on boot.
- /etc/cron.hourly
- Directory for scripts to be executed every hour.
- /etc/cron.daily
- Directory for scripts to be executed every day.
- /etc/cron.weekly
- Directory for scripts to be executed every week.
- /etc/cron.monthly
- Directory for scripts to be executed every month.
- /etc/cron.yearly
- Directory for scripts to be executed every year.
SYSTEM UNITS¶
- cron.target
- The target unit which starts the others. This should be enabled and
started to use cron functionality.
- cron-schedule.timer
- The timer units which pull the cron-schedule.target units at the
appropriate time. Started and stopped by the cron.target unit. These units
cannot be controlled manually.
- cron-schedule.target
- The targets invoke all service units wanted by them, including
cron-schedule.service.
- cron-schedule.service
- The service units which run scripts in the cron directories. Started and
stopped by the cron- schedule.target units. These units cannot be
controlled manually. You can use journalctl(1) to view the output
of scripts run from these units.
LIMITATIONS¶
This cron replacement doesn't send any mails. The log of jobs is saved in
systemd journal. Do
not use with a cron daemon or anacron, otherwise
scripts may be executed multiple times.
EXAMPLES¶
- Start cron units
- # systemctl start cron.target
- Start cron units on boot
- # systemctl enable cron.target
- View script output
- # journalctl -u cron-boot
# journalctl -u cron-hourly
# journalctl -u cron-daily
# journalctl -u cron-weekly
# journalctl -u cron-monthly
# journalctl -u cron-yearly
- Example service file executed every hour
- [Unit]
Description=Update the man db
[Service]
Nice=19
IOSchedulingClass=2
IOSchedulingPriority=7
ExecStart=/usr/bin/mandb --quiet
[Install]
WantedBy=cron-hourly.target
NOTES¶
- 1.
- The exact times scripts are executed is determined by the values of the
special calendar events hourly, daily, weekly,
monthly, and yearly defined by systemd.time(7).
- 2.
- run-parts(8) is used to run scripts. Scripts must be executable by
root to run.
DIAGNOSTICS¶
With systemd >= 209, you can execute "systemctl list-timers" to
have a overview of timers and know when they will elapse.
SEE ALSO¶
systemd(1),
systemd.unit(5),
systemd.service(5),
systemd.target(5),
systemd.timer(5),
systemd.time(7),
run-parts(8)
AUTHOR¶
Dwayne Bent