Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


systemd units to run cron scripts


systemd units to provide cron daemon functionality by running scripts in cron directories.
The crontabs are automaticaly translated using /usr/lib/systemd/system-generators/systemd-crontab-generator.


Add executable scripts to the appropriate cron directory (e.g. /etc/cron.daily) and enable systemd-cron:

# systemctl daemon-reload
# systemctl enable
# systemctl start

The project also includes simple crontab command equivalent, which behaves like standard crontab command (and accepts the same main options).

The scripts should now be automatically run by systemd. See man:systemd.cron(7) for more information.


  • systemd ≥ 236
  • UsrMerged system
  • C and C++20 compilers
  • libssl (-lcrypto)
  • pkgconf (optional)
  • support for /usr/lib/sysusers.d/*.conf (optional)
  • run-parts (optional, disabled by default)
  • sendmail from $SENDMAIL or in $PATH or in /usr/sbin:/usr/lib (optional, evaluated at runtime)

Dependencies history

  • systemd ≥ 197, first support for timers
  • systemd ≥ 209, yearly timers
  • systemd ≥ 212, persistent timers
  • systemd ≥ 217, minutely, quarterly & semi-annually timers
  • systemd ≥ 228, RemainAfterElapse option, might be usefull for @reboot jobs
  • systemd ≥ 229, real random delay support with RandomizedDelaySec option (bug)
  • systemd ≥ 233, support for new ~ = 'last day of month' and '9..17/2' .timer syntax
  • systemd ≥ 235, support for timezones
  • systemd ≥ 236, LogLevelMax option
  • systemd ≥ 251, OnFailure handler receives $MONITOR_UNIT and more.
  • systemd ≥ 255, SetLoginEnvironment: no change needed.


There exists packages avaible for:

There is also a old .spec file for Fedora in contrib/.

A complete list of all packages can be browsed at Repology.

You can also build it manually from source.



$ ./configure
$ make


$ make DESTDIR="$destdir" install


The configure script takes command line arguments to configure various details of the build. The following options follow the standard GNU installation directories:

  • --prefix=<path>
  • --bindir=<path>
  • --datadir=<path>
  • --libdir=<path>
  • --libexecdir=<path>
  • --statedir=<path>
  • --mandir=<path>
  • --docdir=<path>

Other options include (pkgconf may be overridden with $PKG_CONFIG):

  • --enable-runparts[=yes|no] Use static units for /etc/cron.{hourly,daily,...} Default: no.
  • --unitdir=<path> Path to systemd unit files. Default: pkgconf systemd --variable=systemdsystemunitdir or <libdir>/systemd/system.
  • --generatordir=<path> Path to systemd generators. Default: pkgconf systemd --variable=systemdsystemgeneratordir or <libdir>/systemd/system-generators.
  • --sysusersdir=<path> Path to systemd-sysusers snippets. Default: pkgconf systemd --variable=sysusersdir or <libdir>/sysusers.d.
  • --enable-boot[=yes|no] Include support for the boot timer. Default: yes.
  • --enable-minutely[=yes|no] Include support for the minutely timer. Default: no.
  • --enable-hourly[=yes|no] Include support for the hourly timer. Default: yes.
  • --enable-daily[=yes|no] Include support for the daily timer. Default: yes.
  • --enable-weekly[=yes|no] Include support for the weekly timer. Default: yes.
  • --enable-monthly[=yes|no] Include support for the monthly timer. Default: yes.
  • --enable-quarterly[=yes|no] Include support for the quarterly timer. Default: no.
  • --enable-semi_annually[=yes|no] Include support for the semi-annually timer. Default: no.
  • --enable-yearly[=yes|no] Include support for the yearly timer. Default: yes.
  • --libcrypto=<flags> Compiler and linker flags required to build and link to libcrypto. Default: pkgconf --cflags --libs libcrypto or -lcrypto.
  • --with-part2timer=file Mapping from basename in /etc/cron.{daily,weekly,etc.) to unit name. Default: /dev/null.
  • --with-crond2timer=file Mapping from basename in /etc/cron.d to unit name. Default: /dev/null.
  • --with-version=ver Downstream version. Default: contents of VERSION.

A typical configuration for the latest systemd would be:

$ ./configure

(the default settings are a common ground between what is seen on current Arch/Debian/Gentoo packaging)

Alternatively you can also generate static .timer/.service to serialize the jobs in /etc/cron.{hourly,daily,weekly,monthly,...} through run-parts:

$ ./configure --enable-runparts=yes

part2timer and crond2timer are in the format


(empty lines and start-of-line #-comments permitted; unitbasename doesn't include ".timer") and may be useful when, for example, /etc/cron.daily/plocate has a timer called plocate-updatedb.timer or /etc/cron.d/ntpsec has a timer called ntpsec-rotate-stats.timer: without the override, the jobs would run twice since native-timer detection would be looking for plocate.timer and ntpsec.timer.

If there is already a perfect 1:1 mapping between /etc/cron.<freq>/<job> and /usr/lib/systemd/system/<job>.timer, then it is not needed to add an entry to these tables.

If your compiler's PCH compilation is broken, build with make PCH=.


Your package should also run these extra commands before starting to ensure that @reboot scripts doesn't trigger right away:

# touch /run/crond.reboot
# touch /run/crond.bootdir

See Also

systemd.cron(7) or in source tree man -l src/man/systemd.cron.7


The project is licensed under MIT. It vendors a derived work of voreutils, which is available under the 0BSD licence.


© 2014, Dwayne Bent : original package with static units
© 2014, Konstantin Stepanov ( : author of crontab generator
© 2014, Daniel Schaal : review of crontab generator
© 2014-2023, Alexandre Detiste ( : maintainer
© 2023, наб ( : rewrite of generator in C++