https://github.com/0xerr0r/crony
Simple docker cron job scheduler
https://github.com/0xerr0r/crony
cron cronjob-scheduler docker
Last synced: over 1 year ago
JSON representation
Simple docker cron job scheduler
- Host: GitHub
- URL: https://github.com/0xerr0r/crony
- Owner: 0xERR0R
- License: apache-2.0
- Created: 2020-10-31T11:03:23.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-02-20T14:46:01.000Z (over 1 year ago)
- Last Synced: 2025-02-28T12:32:07.463Z (over 1 year ago)
- Topics: cron, cronjob-scheduler, docker
- Language: Go
- Homepage:
- Size: 272 KB
- Stars: 15
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# crony
Simple docker cron job scheduler.
## Features
- Start existing docker container periodically
- Send a mail after the job execution (always, or only on failure) with stdout/stderr
- Automatically register new containers
- healthchecks.io integration (job start/return code, duration)
## Usage
Start crony with following `docker-compose.yml`
```yaml
version: "2.1"
services:
crony:
image: ghcr.io/0xerr0r/crony:latest
container_name: crony
volumes:
# needs access to host docker socket to read container labels and start job containers
- /var/run/docker.sock:/var/run/docker.sock:ro
# to synchronize the time zone with host
- /etc/localtime:/etc/localtime:ro
environment:
# mail settings
- SMTP_HOST=smtp.gmail.com
- SMTP_PORT=587
- SMTP_USER=xxx@googlemail.com
- SMTP_PASSWORD=xxx
- MAIL_TO=xxx@gmail.com
- MAIL_FROM=CRONY
# global mail policy: always, never or onerror
- MAIL_POLICY=always
# optional: log level (one of trace, debug, info, warn, error, fatal), info is default if not set
- LOG_LEVEL=info
mem_limit: 30MB
```
Use following labels in your docker container which should be scheduled by crony:
```yaml
...
labels:
# cron string
- crony.schedule="*/15 6-23 * * *"
# optional to override the global settings
- crony.mail_policy=onerror
# optional, use following job UUID for reporting to healthcheck.io
- crony.hcio_uuid=394ed711-afca-4a4f-9cdb-16b7e976418e
...
```