1
0
Fork 0
mirror of https://github.com/yavook/kiwi-cron.git synced 2024-11-21 15:03:01 +00:00
(mirror) The cron-job solution for kiwi-scp
Find a file
2022-03-02 18:54:58 +01:00
bin rename scheduler 2022-03-02 18:54:58 +01:00
libexec/kiwi-cron rename scheduler 2022-03-02 18:54:58 +01:00
.drone.yml ldericher -> yavook image name 2022-02-27 15:51:14 +01:00
Dockerfile rename scheduler 2022-03-02 18:54:58 +01:00
LICENSE ldericher -> yavook 2022-02-27 16:45:03 +01:00
README.md Time Zones 2022-03-01 18:44:09 +01:00

kiwi-cron

Build Status

kiwi - simple, consistent, powerful

Simple cron-jobs for kiwi-scp

Quick start

kiwi-cron comes with a (slightly) opinionated cron daemon config for periodic jobs. Just drop your scripts into the relevant directory under /kiwi-cron, that's it.

You will likely want to automate some tasks regarding your docker infrastructure. That's why the kiwi-cron images package a current docker-cli you can just mount your docker.sock in its containers and use docker commands normally.

Simple jobs

On startup, kiwi-cron checks for possible job files in the /kiwi-cron directory structure.

For each subdirectory, a random valid cron schedule is generated, so that:

  • /kiwi-cron/hourly runs once every hour (random minute)
  • /kiwi-cron/daily runs once every day (random nighttime value)
  • /kiwi-cron/weekly runs once every weekend (random nighttime value on Saturday or Sunday)
  • /kiwi-cron/monthly runs once every month (random nighttime value on a random day)
  • /kiwi-cron/yearly and /kiwi-cron/annually runs once a year (random nighttime value on a random day in January or February)

Cron schedules are regenerated once on each startup, only for directories that have files.

Time Zones

kiwi-cron images include the tzdata package and automatically handle /etc/localtime on startup. By default, "Etc/UTC" is set as the container time zone.

To use a different time zone, change the container environment variable TZ to your liking, e.g. "Europe/Berlin".

Finer granularity: The /kiwi-cron/every directory

Directories like /kiwi-cron/every/5_minutes will run scripts every 5 minutes. kiwi-cron picks up on that format and generates valid cron schedules on startup.

You can define schedules to be run every N minutes, hours, days, or months by creating the corresponding directories.

Scheduling for every N weeks (or years) doesn't work that way; jobs in those directories will instead be run every week (or every year).

Inspection

Checking the generated cron schedules is done using the standard crontab command: docker exec kiwi-cron-container crontab -l will show the effective schedules.