# flatcar-crontab A `crontab` command for [Flatcar Container Linux](https://www.flatcar.org/), written in bash, that needs nothing beyond what Flatcar ships. Flatcar has no cron, and no official or sysext-bakery extension provides one. This wrapper lets scripts that call `crontab` run unchanged: each crontab line becomes a systemd `--user` timer and service for the calling user. ## Install ```bash sudo install -D -m 0755 crontab /opt/bin/crontab sudo loginctl enable-linger core # the user that owns the crontab ``` `/opt/bin` must be on the `PATH` of whatever calls `crontab`. Linger keeps the user's timers running without a login session. ## Usage ```bash crontab FILE # replace the crontab from a file crontab - # replace the crontab from stdin crontab -l # print it crontab -r # remove it ``` There is no `crontab -e`: edit a file and install it. ## Checking jobs ```bash systemctl --user list-timers --all journalctl --user -u crontab-job-3 ``` Jobs are numbered in crontab order. ## Files | Path | Content | |---|---| | `~/.config/crontab-timers/crontab` | The installed crontab | | `~/.config/crontab-timers/jobs/N.sh` | The command of job N | | `~/.config/systemd/user/crontab-job-N.{timer,service}` | Generated units | ## Supported schedules Five fields, each `*`, `*/n`, a value, `a-b`, `a-b/n` or a comma list. Month and weekday names work. Weekdays do not accept steps, and a weekday range must be ascending (`0-2`, not `5-1`). These are refused, and the installed crontab is left as it was: - `@daily` and other `@` schedules - `VAR=value` lines - Unescaped `%` (`\%` is accepted and becomes `%`) - Restricting both day-of-month and weekday: cron ORs them, systemd ANDs them ## Differences from cron - A run that comes due while the previous one is still active is skipped, not started alongside it. - There is no mail; capture job output yourself, for example with `logger`. - Runs missed while the machine was off are not caught up, as in cron. - Times follow the host's time zone, which is normally UTC on Flatcar.