is a wrapper providing cron jobs with the ability to log each run, to timeout long running or hung jobs, to randomize startup times, and to selectively mail job output. In normal usage, a crontab(5)
entry invokes cronjobber
, which then invokes your job. The following options are recognized:
Short name for this job. Used in mail subject lines and error messages to identify this job.
Name of directory used to hold job state and logs. This directory must exist and must be writable by the crontab owner. It must also support fcntl(2)
Path to actual job to run, and any arguments. cronjobber passes this string unmodified to a shell to execute. Path is relative to jobdir. If no jobdir is specified, path will be relative to HOME. It is probably best to specify the full path to the job.
Change to jobdir before invoking the job. If -D is not given, then the value of HOME is used. If HOME is not set, then the password entry for the effective user id is used.
Maximum random backoff time. If not specified, the job will be executed immediately. Otherwise, cronjobber will wait for a random time between 0 and maxbackoff seconds to execute the job.
Path to checker script relative to statedir. See below for the checker API.
Modify environment passed to job
and to checker
. A minimal environment is constructed and passed to the job and to the checker. This includes HOME
, and USER
. Additional variables may be included by using the -e
flag. If the argument to -e
is just a variable name without an equals, then the value of that variable at cronjobber
run time will be included in the made-up environment. If the argument has an equals, but no value, then the variable will be set, but empty in the made-up environment. Otherwise if a value is provided, that will be the value set in the made-up environment.
Multiple environment variables can be set by using multiple -e
Set umask before invoking job. Use the normal octal representation.
Attempt to kill job after timeout seconds. If no timeout is given, the job may run indefinitely. The default signal is SIGTERM, but this may be changed with the -k flag. It is best to test that timeouts actually work on your system. You may have to change the signal number because different shells may ignore certain signals.
If the -r flag was given to enable a job timeout signal, then send signal signo rather than the default SIGTERM. signo must be numeric.
If cronjobber discovers the previous instance of itself has crashed (the log is still present), it will send a message with a subject "crashed" and the jobname. You can change this subject with the -5 flag.
If the checker decides the job has failed, cronjobber will send a message with a subject "failed", and the jobname. You can change this subject with the -S flag.
Set the envelope sender and From: header to From.
Send crash and error messages to To. To send to multiple recipients, use multiple -T flags.
Specify exact path to sendmail. cronjobber
will check MAILER
or the PATH provided by cron(8)
for sendmail. This path may not include sendmail, so it is best to spell it out with -M
cronjobber removes log files older than age seconds. age may be suffixed by s, m, h or d to indicate seconds, minutes, hours or days, respectively. For example, use 7d to specify a week.
List command line arguments. Parse command line, print the results and exit.
Print version and exit.