GithubHelp home page GithubHelp logo

systemd-cronjobs's Introduction

systemd-cronjobs - crond replacement using systemd timers
=========================================================

The purpose of this package is to replace any crond package in PLD with much
more powerful systemd timers, while not forcing them for every PLD
installation.

The package does not aim to be backward-compatible with existing crontabs.
This could be done with some wrapper or systemd generator, but the cron jobs
would be still designed for crond and just extra overhead would be added under
systemd.

Guarding any crontab entry with /sbin/systemd_booted is an extra overhead for
non-systemd systems.

The idea is that PLD packages can provide both crontabs and systemd timers,
like they provide systemd units and init.d startup scripts. When a crond is
installed, the crontabs would be used, when the new 'systemd-cronjobs' package
is installed, then the systemd timers will be used.

systemd-cronjobs obsoletes all cron daemons, so it can be used when no crond
services are required in the system โ€“ neither by any of installed packages,
nor by users.

Packaging cronjobs
------------------

/etc/cron.{hourly,daily,monthly,weekly} only
............................................

Just make sure they don't require 'crondaemon' or 'crontabs', a directory
dependece should pull a crond or systemd-cronjobs.

Explicit 'Require: cronjobs' can be added, but is not required

/etc/cron.d/* crontabs, no existing systemd timers
..................................................

Until systemd-cronjobs compatible timer units are added, the old 'crondaemon'
or 'crontabs' dependency should be used.

To make package compatible with systemd-cronjobs systemd timer and service
units should be added for every crontab entry:

cronjob-%{name}.timer
cronjob-%{name}.service


For a crontab like this:
01 23 * * * someuser do_something

The equivalent systemd units would be:

cronjob-something.timer:

[Unit]
Description=something cronjob timer

[Timer]
OnCalendar=23:01

[Install]
WantedBy=cronjobs.target

cronjobs-something.service:

[Unit]
Description=something cronjob

[Service]
ExecStart=/usr/bin/do_something
User=someuser

The first one defines the schedule and should be WantedBy cronjobs.target (not
multi-user.target, so it is used only when crond is not installed). The other
defines how the service should be started each time the timer fires.

The usual %systemd_{post,preun,reload} macros should be used in
%post/%preun/%postun for the cronjob-%{name}.timer unit.

After systemd timers are added the 'crondaemon'/'crontabs' dependency should
be changed to: Requires: cronjobs. This will allow using crond or systemd
timers.

systemd-only packages
.....................

Packages that are designed only for systemd do not need this systemd-cronjobs
package. They may provide just own systemd timers, installed under
multi-user.target or timers.target.

packages with upstream provided crontabs and systemd timers
...........................................................

If upstream provides crontab and systemd.timer that don't conflict with each
other, then they can be used and the crondaemon/crontabs/cronjobs dependecny
may be dropped (unless it is critical for the timed services to be started).

Packaging cron daemons
----------------------

Cron daemon packages should Provide and Obsolete 'cronjobs' in addition to
'crondaemon' and 'crontabs'.

systemd-cronjobs's People

Contributors

glensc avatar jajcus avatar

Watchers

 avatar  avatar  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.