Giter VIP home page Giter VIP logo

systemd-cron's Introduction

systemd-cron

systemd units to run cron scripts

Description

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.

Usage

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

# systemctl daemon-reload
# systemctl enable cron.target
# systemctl start cron.target

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.

Dependencies

  • systemd ≥ 197
    • systemd ≥ 209, yearly timers
    • systemd ≥ 212, persistent timers
    • systemd ≥ 217, minutely , quarterly & semi-annually timers
  • run-parts
  • python 3
  • /usr/sbin/sendmail (optional, evaluated at runtime)
  • gcc or clang (needed to build crontab_setgid.c; this helper is optional and evaluated at runtime)

Installation

There exists packages avaible for:

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

You can also build it manually from source.

Packaging

Building

$ ./configure
$ make

Staging

$ make DESTDIR="$destdir" install

Configuration

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>
  • --confdir=<path>
  • --datadir=<path>
  • --libdir=<path>
  • --statedir=<path>
  • --mandir=<path>
  • --docdir=<path>

Other options include:

  • --unitdir=<path> Path to systemd unit files. Default: <libdir>/systemd/system.
  • --runparts=<path> The path installations should use for the run-parts executable. Default: <prefix>/bin/run-parts.
  • --enable-boot[=yes|no] Include support for the boot timer. Default: yes.
  • --enable-minutely[=yes|no] Include support for the minutely timer. Requires systemd ≥ 217. 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. Requires systemd ≥ 217. Default: no.
  • --enable-semi_annually[=yes|no] Include support for the semi-annually timer. Requires systemd ≥ 217. Default: no.
  • --enable-yearly[=yes|no] Include support for the yearly timer. Requires systemd ≥ 209. Default: no.
  • --enable-persistent[=yes|no] Make timers persistent. Requires systemd ≥ 212. Default: no.
  • --enable-setgid[=yes|no] Compile setgid C helper for crontab. Needs GCC or Clang. Default: no.

A typical configuration for the latest systemd would be:

$ ./configure --prefix=/usr --confdir=/etc --enable-yearly --enable-persistent

If you only want the generator (you'll have to provide your own /etc/crontab to drive /etc/cron.daily/ etc...):

$ ./configure --enable-boot=no --enable-hourly=no --enable-daily=no --enable-weekly=no --enable-month=no --enable-persistent --prefix=/usr --confdir=/etc

Caveat

Your package should also run these extra commands before starting cron.target 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

License

The project is licensed under MIT.

Copyright

© 2014, Dwayne Bent : original package with static units
© 2014, Konstantin Stepanov ([email protected]) : author of crontab generator
© 2014, Daniel Schaal : review of crontab generator
© 2014, Alexandre Detiste ([email protected]) : manpage for crontab generator

systemd-cron's People

Contributors

a-detiste avatar dbent avatar wavexx avatar dpeteler avatar msva avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.