Skip to content

ivan-leschinsky/cronenberg

 
 

Repository files navigation

cronenberg

Build Status Go Report Card Documentation

It's like cron, but kinda twisted.

Install to own docker image

# your dockerfile
# ...
COPY --from=vanopiano/cronenberg:latest /sbin/cronenberg /sbin/cronenberg
# ...

Original Installation

You can either download the appropriate release from the releases page or install via go get:

go get -u github.com/ess/cronenberg/cmd/cronenberg

Basics

Cronenberg works similarly to the standard cron that you already know and love, but with a few differences:

  • It is not meant to be run as a system service
  • It does not use a traditional crontab
  • Jobs for a given cronenberg instance are loaded from a YAML file
  • It supports locking jobs (jobs that can only ever have one running instance)
  • It logs to STDOUT
  • It supports both incoming (from the system) and job-scoped environment variables

In short, this is the cron implementation that you run along side your 12-factor application.

Jobs File

There is not a hard-coded location for your jobs file. Instead, you pass the jobs file as the first argument to the cronenberg command like so:

cronenberg /path/to/my/jobs/file.yml

This is just a YAML file containing an array of Job objects. Here's an example jobs file:

# Job objects require a name, a command, and a schedule (when). You can also
# specify a description, whether or not the job locks, and a hash of environment
# variables for the job.

# This is just a normal job that runs every minute
- name: what-am-i
  command: echo "I am a command"
  when: "* * * * *"

# This is a locking job that is scheduled to run every minute so long as there
# is not already an instance of the job in progress.
- name: picky-picky
  command: 'echo "I am a picky command" ; sleep 70'
  when: "* * * * *"
  lock: true

# This is a job that runs every five minutes and specifies an environment
# variable. If this variable is also set in cronenberg's executing shell, the
# value configured here takes precedence.
- name: know-your-environment
  command: echo $flibberty
  when: "*/5 * * * *"
  env:
    flibberty: gibbets

History

  • v1.0.0 - Initial Release

About

It's like cron, but kinda twisted

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 82.7%
  • Shell 8.1%
  • Makefile 8.0%
  • Dockerfile 1.2%