1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! Cron for Containers is a lightweight cron daemon for containers
//! that aims to be an in-place replacement for ofelia wherever mail
//! capabilities are not required.
//!
//! Currently, only docker and podman are supported.
//!
//! __WIP:__ Careful, fresh paint! Only the local job is currently implemented.
//! Come back later or open an issue on the repository if you're interested in the project.
//!
//! ## Installation
//!
//! Install the executable with cargo:
//!
//! ```bash
//! cargo install cfc
//! ```
//!
//! ## Usage
//!
//! You may either provide a configuration file or extract configuration from container
//! labels.
//!
//! The scheduling format is an "augmented" cron format inspired by go's implementation. E.g. `@every 10m`` or `0 10 * * * *`.
//!
//! *Note:* The cron format does not have to contain the seconds specifier
//!
//! You can configure four different kind of jobs:
//!
//! `job-exec`: Executed in a running container.
//! `job-run`: Executed in a new container, using a specific image.
//! `job-local`: Executed on the host running ofelia.
//! `job-service-run`: Executed in a new "run-once" service, for running inside a swarm
//!
//! ### INI-style config
//!
//! ```ini
//! [job-exec "job-executed-on-running-container"]
//! schedule = @hourly
//! container = my-container
//! command = touch /tmp/cfc
//! ```
//!
//! ### YAML-style config
//!
//! ```yaml
//! job-executed-on-running-container:
//! kind: job-exec
//! schedule: "@hourly"
//! container: my-container
//! command: touch /tmp/cfc
//! ```
//!
//! ### Label-based config
//!
//! ```bash
//! docker run -it --rm \
//! --label cfc.job-run.my-test-job.schedule="@every 5s" \
//! --label cfc.job-run.my-test-job.command="echo Hello world" \
//! alpine:latest sleep 9999
//! ```
//!
//! ### Ofelia compatibility
//!
//! Add `--ofelia` to the command-line when running cfc to run in compatibility mode.
//!
//! ## Note
//!
//! Though both an executable and a library are made available, the library is only
//! intended for consumption by the executable and its API should not be considered stable.