neilmock / cronton

Tame the cron.

This URL has Read+Write access

neilmock (author)
Tue Oct 13 15:03:39 -0700 2009
commit  3a1c86fbb8d7bb7b5726b6d818fce7092459015d
tree    a8453a9de92b905776178326468efc9c4ef9aedf
parent  f500276ca76b479373e13237c0607c7c27b23c32
name age message
file .gitignore Sat Oct 10 15:17:55 -0700 2009 initial commit [neilmock]
file README.md Tue Oct 13 15:03:39 -0700 2009 trying to format links correctly in README [neilmock]
directory bin/ Sat Oct 10 15:17:55 -0700 2009 initial commit [neilmock]
directory cronton/ Tue Oct 13 15:01:54 -0700 2009 bugfix and README enhance [neilmock]
file setup.py Sat Oct 10 15:17:55 -0700 2009 initial commit [neilmock]
directory tests/ Sat Oct 10 15:17:55 -0700 2009 initial commit [neilmock]
README.md

Cronton

Tame the cron.

Cronton lets you manage your crontab in a readable, source-controlled (hopefully) definition file, and provides a runner with callbacks for executing cron definitions.

Overview

We've all been there. Tons of cron jobs running under different accounts, definitions scattered all over the place, and worst of all probably none of it is under source control.

Cronton tries to cure some of the headaches around cron management.

Cron Definition Files

Cronton uses a YAML definition file that strives to mimic the format used by Google's App Engine Cron implementation.

Here's an example Cronton definition file:

crontab:
- description: this is a useless cron task
  command: /bin/cat
  schedule: every 15 minutes

Task Runners

By default, Cronton runs all commands specified in the definition file through a custom runner. Thus, if you installed the crontab generated by the definition file above, your crontab will look like this:

0,15,30,45 * * * * /usr/local/bin/cronton -e /bin/cat

The rationale for sending all tasks through the runner is to provide a unified execution path for all cron jobs. This paves the way for things like specifying success and failure hooks for cron jobs, automatically halting scheduled execution under certain parameters, etc. Basically, if you have a need that cron doesn't necessarily provide out of the box, you can build a custom runner to handle it.

Usage

Parse the definition and print it out:

$ cronton -o definition.yml

Install it under the current user:

$ cronton -i definition.yml

Optionally specify a user under which to install the crontab:

$ cronton -u cron -i definition.yml

Specify a custom runner for the crontab (must be on the load path):

$ cronton -r module.namespaced.Runner -i definition.yml

Execute a script outside of cron using a custom runner:

$ cronton -r module.namespaced.Runner -e /path/to/script

Meta

  • Code: git clone git://github.com/neilmock/cronton.git