1 Whenjobs is a powerful but simple cron replacement.
3 Two key advantages over cron are a simpler syntax for writing rules
4 and a powerful dependency system that lets one job depend on variables
5 set when other jobs run (allowing, for example, one job to run only
6 when another job has finished successfully).
8 Below is an example whenjobs script so you can get a feel for the
9 language. Read the whenjobs(1) man page for full information.
11 ----------------------------------------------------------------------
12 (* Every 10 minutes, get the latest tagged version from the
13 * git repository. The variable 'version' will be set to something
14 * like "v1.2.3", "v1.2.4", etc over time as new releases get
20 tag=`git-describe --tags`
21 whenjobs --set version $tag
24 (* When the 'version' variable changes (ie. a new release is
25 * tagged) try to build it. 'changes' is a function that compares
26 * the previous value of a variable from when this job last ran
27 * with the current value of a variable, and returns true if the
28 * previous and current values are different.
30 when changes version :
34 git reset --hard $version
36 make clean all check dist
37 whenjobs --set successful_local_build $version
40 (* In parallel, build on a remote machine. *)
41 when changes version :
43 ssh remote ./do_build $version
44 whenjobs --set successful_remote_build $version
47 (* Only when the new release has been successfully built on local
48 * and remote, upload it to the website.
50 when successful_local_build == version &&
51 successful_remote_build == version:
54 curl -T name-$success.tar.gz ftp://ftp.example.com/upload/
56 ----------------------------------------------------------------------
58 To get started with whenjobs, edit your script:
62 or list the current script:
66 You must run 'whenjobsd' (the whenjobs daemon) as the local user.
67 Each user must run their own daemon. You can query the state of the
68 daemon of start it using the whenjobs command line tool:
70 whenjobs --daemon-start
71 whenjobs --daemon-status
72 whenjobs --daemon-stop
74 If you want the daemon to start when the machine is booted, add the
75 following line to /etc/rc.local (replace 'username' with your
78 su username -c /usr/sbin/whenjobsd
80 Whenjobs is an open source project distributed under the GNU General
81 Public License, version 2 or at your option any later version. Read
82 the file 'COPYING' for the full license.
85 http://people.redhat.com/~rjones/whenjobs
87 Send patches or suggestions to Richard Jones <rjones@redhat.com>.