| SYSTEMD.CRON(7) | Miscellaneous Information Manual | SYSTEMD.CRON(7) |
systemd.crom —
systemd units for cron periodic jobs
cron.target
cron-update.path, cron-update.service
cron-mail@.service
These units provide the functionality usually afforded by the cron daemon — running scripts in /etc/cron.schedule directories and sending mail on failure.
Crontabs are monitored by cron-update.path
and are automatically translated by
systemd-crontab-generator(8).
You can also use this mechanism to mask an unneeded crontab
provided by a package via systemctl
mask
package.timer.
cron.targetcron-update.pathcron-update.servicesystemctl
daemon-reload to re-run the generator.
cron-mail@.serviceSENDMAIL) in case a cron service unit fails,
succeeds, or succeeds-but-only-if-it-wrote-something. The instance name
(the bit after the @)
is the unit name, followed by optional arguments delimited by colons
(‘:’):
CRON_MAIL_SUCCESS=nonempty)
for OnSuccess=),systemctl
status output, don't add usual
journalctl metadata to the output (equivalent
to
CRON_MAIL_FORMAT=nometadata),
andOverriding this via systemctl
edit can be useful, especially for units under
/etc/cron.*.
Do not use with a cron daemon or anacron, otherwise scripts may be executed multiple times.
All services are run with Type=oneshot, which means you can't use systemd-cron to launch long lived forking daemons.
The generator can optionally turn any crontabs in persistent
timers with the
PERSISTENT=true
flag, while a regular cron and anacron setup won't catch up on the missed
executions of crontabs on reboot.
#systemctlstartcron.target
#systemctlenablecron.target
#journalctl -u cron-daily
#systemctleditcron-geoip-database-contrib-root-1.timer
and add
[Timer] OnCalendar= OnCalendar=*-*-* 18:36:00
#systemctleditcron-daily.service
and add
[Service] CPUSchedulingPolicy=idle IOSchedulingClass=idle
[Unit] Description=Update the man db [Service] Nice=19 IOSchedulingClass=2 IOSchedulingPriority=7 ExecStart=/usr/bin/mandb --quiet [Install] WantedBy=cron-hourly.target
The exact times scripts are executed is determined by the values of the special calendar events hourly, daily, weekly, monthly, and yearly defined in systemd.time(7).
systemctl
list-timers shows an overview of current timers and
when they'll elapse.
crontab(1), systemd(1), crontab(5), systemd.service(5), systemd.timer(5), systemd.unit(5), systemd.time(7), run-parts(8), systemd-crontab-generator(8)
| 2023-08-13 | systemd-cron 2.4.1-1 |