Version 2 of cron

Updated 2002-08-06 14:58:46

Purpose: discuss some of the connections between Tcl and the cron facility

Cron is an application available on many platforms designed to allow one to schedule invocations of applications at set calendar date and times on a computer.

When an application is invoked, it appears to run as a particular user, BUT with a minimal environment variable setup and typically in a preset command shell.

The limited environmental shell setup is the first problem users typically encounter - they expect that they will find various variables that are set during their machine's startup environment during login, or their own personalized login environment - but those are not present.

Thus one must decide to take one of two courses of action:

  • write the application in such a way that it needs no special variables
  • set the special variables up that may be needed
  • create some sort of wrapper application that presets the operational environment

What kinds of variables might be needed? Well, for instance, special $PATH values, database pointer variables, printer names, etc. all may need to be set up.

What else can go wrong?

Some applications expect certain terminal settings - some place to write output, some place to prompt for input, perhaps access to some other special device (like an X Window display!). It is often the user will find that they have dependencies (via subroutines or other invoked applications) that they weren't even aware existed. However, these limitations, if dealt with persistently, can eventually be overcome in most cases.

A common request is help to invoke Tk applications from cron. There are two different requests I have seen here:

  • how to invoke Tk apps who do not need an X display - perhaps some sort of image manipulation extension

Another connection with cron - tkcron is at least one Tk application that allows a GUI interface to setting up entries in cron.