Cron-jobs at DESY - an abstract of the K5Cron suite

What is K5Cron

K5cron is a kerberized server-client solution to periodically execute commands under your ID on a host of your choice. The server provides the functionality of authentication and acquisition of AFS access rights, managing the crontabs (tables in text form that hold information about what and when a command gets executed) and finally executing jobs. The client is used to view and edit the user's crontab as well as authenticating to the server. K5Cron uses Kerberos5 for that purpose.

How to use the client

K5crontab – maintain crontab files for individual users


 k5crontab {-l|-e} [-s server] [-d]

k5crontab is the program used to install, deinstall or list the crontabs of k5cron. The prerequisite is that you own a ticket granting ticket (TGT), which is usually issued automatically during login. To check if you own a valid TGT, just execute 'klist'. If you should get a message like 'no ticket file', you need to execute the 'kinit' command.
K5crontab takes two arguments, '-l' or '-e' for listing or editing your personal crontab. You can additionally choose to output some debug information by adding a '-d'. The answer after the upload is the number of active entries or an error message. If the number does not correspond to your entries, look at your crontab again. The server marks wrong formatted lines with a '#BAD'.
To use a different k5cron server as specified in the k5crontab.conf or if this file is missing, you can use the '-s' option to override the server defaults or switch to a different k5cron server.

The crontab layout

Usually every line within the crontab contains information about exactly one job. A few exceptions are:

  • Commentaries, carried out by a starting # in the line
  • The mail target, starting with a MAILTO=, where you can optionally specify an output email address
  • The REXEC= line, which is necessary and specifies the used remote execution mechanism (see below)

A crontab entry is in the form of

 {Minute} {Hour} {Day} {Month} {Weekday} {target host} {command}

Weekday is a number, starting from 0 for Sunday until 6 for Saturday. A star represents 'every'.


 0 0 * * * pal ls ~/private
 0 0 * * * pal-sld5 ls ~/private
 0 0 * * * pal-sld4 ls ~/private

This line would execute 'ls ~/private' on pal etc. every midnight and email you the output to your default or specified e-mail address.
The REXEC line is set to a preset default, so you shouldn't worry about that. If you intend to use different remote execution services, just specify the according command there. The %h gets exchanged with the given host and %c with the command at execution time of a job.