Wiki
Clone wikiwhenjobs / Home
Welcome
Welcome to our little Wiki about Whenjobs. This Whenjobs-Repo is a fork of the official one at http://people.redhat.com/~rjones/whenjobs as we wanted to have some features for our users included that might still need some time to get online upstream.
What is Whenjobs?
Whenjobs are planed to be a powerful but simple cron replacement. So far the official version had two limitations
- no root user could use whenjobs,
- users couldn't start whenjobs-daemon when /usr/sbin wasn't in the path variable
For the first issue we still work on a usermanagement for it, but we are on our way to fix that. The second issue is hardcoded solved and working already.
Comparison to "normal" cronjobs
Two key advantages over cron are a simpler syntax for writing rules and a powerful dependency system that lets one job depend on variables set when other jobs run (allowing for example, one job to run only when another job has finished successfully).
Whenjobs example:
every 10 minutes :
<<
cd /my/git/repo
tag=`git-describe --tags`
whenjobs --set version=$tag
>>
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
>>
when changes version :
<<
ssh remote ./do_build $version
whenjobs --set successful_remote_build=$version
>>
when successful_local_build == version && successful_remote_build == version :
<<
cd /my/git/buildrepo
curl -T name-$success.tar.gz ftp://ftp.example.com/upload/
>>
This will do the following:
- get every 10 mintes 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,
- 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 last ran with the current value of it, and returns true if the previous and current values are different,
- in parallel, build on a remote machine,
- only when the new release has ben successfully built on local and remote, upload it to the website.
Using whenjobs
To get started with whenjobs, edit your script:
whenjobs -e
or list the current script:
whenjobs -l
You must run 'whenjobsd' (the whenjobs daemon) as the local user. Each user must run their own daemon. You can query the state of the daemon of start it using the whenjobs command line tool:
whenjobs --daemon-start whenjobs --daemon-status whenjobs --daemon-stop
If you want the daemon to start when the machine is booted, add the following line to /etc/rc.local (replace 'username' with your username):
su username -c /usr/sbin/whenjobsd
Whenjobs is an open source project distributed under the GNU General Public License, version 2 or at your option any later version. Read the file 'COPYING' for the full license.
Updated