The is a script to wrap your (existing) cronjob.

It does a few small and helpful things:

  • The wrapper fetches any output of stdout + stderr and creates a log file with a name based on the started script (remark: you can override the naming with a 3rd parameter). Do not try to keep silent anymore: write as many output as you want! And some more good news: Write the output in your cronscripts that you can understand the execution!
  • The wrapper logs a few things by itself:
    • the started command
    • starting time
    • ending time
    • … and if having them: the execution time
    • the exitcode of the command/ script; This means: be strict like all commands do! Write your cronjob script that ends with exitcode 0 if it is successful and quit with non-zero if any error occurs. Be strict with the exitcode to be able to monitor the cronjobs!
    • The TTL value (parameter 2) generates a file with a timestamp. A check script detects with it if a cronjob log is outdated
  • all metadata and the output will be written in a log file with parsable

Show help

Use -h to show a help: -h


Puts control and comfort to cronjobs.

license: GNU GPL 3.0


Showing help ...


    TTL       integer value in [min]
              This value says how often your cronjob runs. It is used to verify
              if a cronjob is out of date / does not run anymore.

    COMMAND   command to execute
              When using spaces or parameters then quote it.
              Be strict: if your job is ok then exit wit returncode 0.
              If an error occurs exit with returncode <> 0.

    LABEL     optional: label to be used as output filename
              If not set it will be detected from basename of executed command.
              When you start a script with different parameters it is highly
              recommended to set the label.

You don't need to redirect the output in a cron config file. STDOUT and
STDERR will be fetched automaticly. 
It also means: Generate as much output as you want and want to have to debug a
job in error cases.

The output directory of all jobs executed by ./ is
The output logs are parseble with simple grep command.

You can run ./ to get a list of all cronjobs and its
status. Check its source. Based on its logic you can create a check script for
your server monitoring.

Replace existing Cronjobs

I am sure you already have some cronjobs on your systems :-)

You don’t need to rewrite anything - we add the wrapper only.

As an example … if you have a daily cronjob like this starting at 3:12 am:

12 3 * * * root /usr/local/bin/ >/tmp/dump.log 2>&1

To use my wrappper

  • you add the wrapper in front
  • add a TTL (in minutes) as first param. It defines how often this job is called. This will let us detect if a job is out of date.
  • add the command as third param - if you use arguments, then you need to quote it
  • optional: add a label for the output file (it overrides the default naming convention of the log)
  • remove the output redirections

The cronjob above needs to be rewritten like that:

12 3 * * * root /usr/local/bin/ 1440 /usr/local/bin/

To test it immediately run con command line:

/usr/local/bin/ 1440 /usr/local/bin/

You may ask: And what is the difference now? First: your task does the same thing(s) like before.

But we us a wrapper with its functions described on top.


And then have a look to the generated files in /var/tmp/cronlogs/. And the next chapter.