whenjobs (git repo) is a cron replacement. From the manual page …

Whenjobs is a powerful but simple replacement for cron. It lets you run jobs periodically like cron, but it also lets you trigger jobs to run when user-defined variables are set or change value. Periodic jobs are written like this: every 10 minutes : << # Get the current load average. load=`awk '{print $1}' /proc/loadavg` whenjobs --set load $load --type float >> When-statements let you create jobs that run based on variables set elsewhere: when load >= 6 : << mail -s "ALERT: high load average: $load" $LOGNAME < /dev/null >> (When statements are "edge-triggered", meaning that this job will only run when the load goes from under 6 to ≥ 6).

The motivation is building things from git automatically. Here is another job script:

Every 10 minutes, get the latest tagged version from the git repository. The variable ‘version’ will be set to something like “v1.2.3”, “v1.2.4”, etc over time as new releases get tagged.

every 10 minutes : << cd /my/git/repo tag=`git-describe --tags` whenjobs --set version $tag >>

When the ‘version’ variable changes (ie. a new release is tagged) try to build it. ‘changes’ is a function that compares the previous value of a variable from when this job last ran with the current value of a variable, and returns true if the previous and current values are different.

when changes version : << cd /my/git/buildrepo git pull git reset --hard $version ./configure make clean all check dist whenjobs --set successful_local_build $version >>

In parallel, build on a remote machine.

when changes version : << ssh remote ./do_build $version whenjobs --set successful_remote_build $version >>

Only when the new release has been successfully built on local and remote, upload it to the website.

when successful_local_build == version && successful_remote_build == version : << cd /my/git/buildrepo curl -T name-$success.tar.gz ftp://ftp.example.com/upload/ >>