mirror of
https://github.com/Luzifer/elastic_cron.git
synced 2024-11-08 22:00:13 +00:00
1.5 KiB
1.5 KiB
Luzifer / elastic_cron
This project is a quick and dirty replacement for running a cron daemon inside docker containers while logging into an elasticsearch instance.
Advantages
- It logs the output of the jobs into an elasticsearch instance
- Crons can be started on seconds, not only on minutes like a conventional cron
- Due to the logs cron jobs can get debugged
- On success and failure a HTTP ping to Healthchecks or Cronitor can be executed
Usage
- Put the binary into your container
- Generate a YAML file containing the cron definition
- Watch your crons get executed in your log stream
Config format
---
elasticsearch:
servers:
- http://localhost:9200
auth: [username, password]
jobs:
- name: date
schedule: "0 * * * * *"
cmd: "/bin/date"
args:
- "+%+"
ping_success: "https://..."
ping_failure: "https://..."
...
elasticsearch
servers
- List of elasticsearch instances of the same cluster to log toauth
- List consisting of two elements: username and password
schedule
- consists of 6 instead of the normal 5 fields:
field allowed values
----- --------------
second 0-59
minute 0-59
hour 0-23
day of month 1-31
month 1-12 (or names, see below)
day of week 0-7 (0 or 7 is Sun, or use names)
Standard format for crontab entries is supported. (See man 5 crontab
)