All Projects → karlicoss → dron

karlicoss / dron

Licence: other
What if cron and systemd had a baby?

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to dron

Sleepto
An alternative to traditional task schedulers
Stars: ✭ 98 (+226.67%)
Mutual labels:  cron, systemd
Restic Systemd Automatic Backup
My restic backup solution using Backblaze B2 storage, systemd timers (or cron) and email notifications on failure.
Stars: ✭ 314 (+946.67%)
Mutual labels:  cron, systemd
adsorber
Ad-blocker for Linux systems purely built on POSIX-compliant shell scripts.
Stars: ✭ 57 (+90%)
Mutual labels:  cron, systemd
gnome-shell-extension-sermon
A GNOME Shell extension for monitoring and managing systemd services, cron jobs, docker and poman containers
Stars: ✭ 27 (-10%)
Mutual labels:  cron, systemd
fuck systemd
A library to bring the joys of non-systemd users to systemd users
Stars: ✭ 19 (-36.67%)
Mutual labels:  systemd
rhythm
Time-based job scheduler for Apache Mesos
Stars: ✭ 30 (+0%)
Mutual labels:  cron
cronode
Cron for Node.js with expressive code
Stars: ✭ 15 (-50%)
Mutual labels:  cron
btrfs-backup
A simple, flexible script for versioned backups using btrfs and rsync
Stars: ✭ 59 (+96.67%)
Mutual labels:  cron
GnusSolution
A complete working solution of gnus+offlineimap+dovecot+msmtp+cron
Stars: ✭ 18 (-40%)
Mutual labels:  cron
systemdspawner
Spawn JupyterHub single-user notebook servers with systemd
Stars: ✭ 79 (+163.33%)
Mutual labels:  systemd
cron-time
Javascript Cron Time Expressions
Stars: ✭ 58 (+93.33%)
Mutual labels:  cron
wimpy.deploy
Ansible role to automate immutable infrastructure scheduling one docker container on one EC2 instance
Stars: ✭ 21 (-30%)
Mutual labels:  systemd
gymbox-bot
Simplify the booking of a gymbox class.
Stars: ✭ 21 (-30%)
Mutual labels:  cron
delayed-notifications-for-gravity-forms
Set delayed notifications for your gravity forms in easy steps
Stars: ✭ 26 (-13.33%)
Mutual labels:  cron
buddy-linux
Do you remember "Wubi Ubuntu Installer"? This project is both a replacement and an improvement of Wubi. You will be able to install your Debian (or derived) distribution on a PC without repartitioning it, simply by using a secondary/external boot device (like a USB drive).
Stars: ✭ 17 (-43.33%)
Mutual labels:  systemd
node-systemd-journald
Native bindings to journald
Stars: ✭ 26 (-13.33%)
Mutual labels:  systemd
sysz
An fzf terminal UI for systemctl
Stars: ✭ 1,258 (+4093.33%)
Mutual labels:  systemd
logback-journal
systemd journal appender for Logback
Stars: ✭ 25 (-16.67%)
Mutual labels:  systemd
service-systemd
Setup a node.js app as systemd service.
Stars: ✭ 35 (+16.67%)
Mutual labels:  systemd
go-systemd-time
📅 Go implementation of systemd relative time adjustments
Stars: ✭ 21 (-30%)
Mutual labels:  systemd
dron – simple frontend for Systemd, inspired by cron.
  • d stands for ‘Systemd’
  • ron stands for ‘cron’

dron is my attempt to overcome things that make working with Systemd tedious

What does it do?

In short, you type dron edit and edit your config file, similarly to crontab -e:

from dron import job

# at the moment you're expected to define jobs() function that yields jobs
# in the future I might add more mechanisms
def jobs():
    # simple job that doesn't do much
    yield job(
        'daily',
        '/home/user/scripts/run-borg /home/user',
        unit_name='borg-backup-home',
    )

    yield job(
        'daily',
        'linkchecker https://beepb00p.xyz',
        unit_name='linkchecker-beepb00p',
    )

    # drontab is simply python code!
    # so if you're annoyed by having to rememver Systemd syntax, you can use a helper function
    def every(*, mins: int) -> str:
        return f'*:0/{mins}'

    # make sure my website is alive, it will send local email on failure
    yield job(
        every(mins=10),
        'ping https://beepb00p.xyz',
        unit_name='ping-beepb00p',
    )

After you save your changes and exit the editor, your drontab is checked for syntax and applied

  • if checks have passed, your jobs are mapped onto Systemd units and started up
  • if there are potential errors, you are prompted to fix them before retrying

Why?

In short, because I want to benefit from the heavy lifting that Systemd does: timeouts, resource management, restart policies, powerful scheduling specs and logging, while not having to manually manipulate numerous unit files and restart the daemon all over.

I elaborate on what led me to implement it and motivation here. Also:

Setting up

  1. install system dependencies (see .ci/run ) – these are necessary for dbus-python library
  2. install dron: pip3 install --user git+https://github.com/karlicoss/dron
  3. install sendmail from your package manager if you want to recieve job failure emails

Using

usage: [-h] {managed,timers,past,edit,apply,lint} ...

positional arguments:
  {managed,timers,past,edit,apply,lint}
    managed             List units managed by dron
    timers              List all timers
    past                List past job runs
    edit                Edit  drontab (like 'crontab -e')
    apply               Apply drontab (like 'crontab' with no args)
    lint                Check drontab (no 'crontab' alternative, sadly!)

optional arguments:
  -h, --help            show this help message and exit

Job syntax

The idea is that it’s a simple python DSL that lets you define simple jobs with minimal friction.

However, if you wish you can pass arbitrary unit properties as keyword arguments as well.

Caveats

  • older systemd versions would only accept absolute path for ExecStart. That should be caught during dron edit though

Potential improvements

  • custom validation; at the moment it runs pylint, mypy and systemd verify
  • make it more atomic?

    E.g. roll back all the changes until daemon-reload

  • more failure report mechanisms?

    Ideally, benefit from ntfy

add issues with various questions that I had in code?

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].