cron

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.


See also cron and Tcl.


Tcl related applications that relate to cron:

 What: cron interface
 Where: ftp://avahi.inria.fr/tcl/tkcron/
        ftp://dslab.csie.ncu.edu.tw/pub/tcl/
        ftp://kolal.inria.fr/tcl/
        ftp://ftp.procplace.com/pub/tcl/sorted/packages-7.6/misc/tkcron-2.12/tkcron-2.12.tcl.gz
 Description: TkCron is a Tk 4 simple interface to crontab creation.
 Updated: 02/1997
 Contact: mailto:[email protected] (Cedric Beust - TkCron v1 author)
        mailto:[email protected] (Wann-Ban Chi - TkCron v2 author)
        mailto:[email protected] (Colin Lee - TkCron v2 author)

 What: cronjob
 Where: ftp://ftp.procplace.com/pub/tcl/sorted/packages-8.0/apps/cronjob/1.0/cronjob-1.0.tar.gz
 Description: Tcl application that provides cron like functionality.
 Updated: 12/2001
 Contact: mailto:[email protected] (Arjen Markus)

 What: Gnome Moleskine
 Where: http://www.micampe.it/software/moleskine/
 Description: Source code editor for the GNOME desktop.
        Makes use of Scintilla.  Has lexers for
        ASP, Baan, Bullant, Eiffel KW, LISP, NN Crontab, PHP
        Ruby, Tcl, VB Script, and more.
        Currently at version 0.7.7 .
 Updated: 02/2002
 Contact: See web site

 What: LARD
 Where: http://apt.cs.manchester.ac.uk/projects/tools/lard/
 Description: Language for Asynchronous Research and Development (LARD)
        is a hardware description language, which uses Tcl as its scripting
        language.
 Updated: 07/2003
 Contact: See web site

 What: MAT
 Where: http://www.ee.ryerson.ca/%7Esblack/mat
 Description: Enterprise Monitoring and Administration Tool (MAT), aka MATtool.
        Used to manage a heterogeneous UNIX network.  The monitoring
        daemon maintains historical info on several monitored parameters
        with graphing and event triggering when thresholds are exceeded.
        Also has self-upgrade ability.
        Allows you to add/modify/delete users, groups, hosts, email aliases,
        filesystems, crontabs, DNS configs, domains and records,
        login messages, services, NIS records, syslogd, syslog files,
        routes, processes, lastlog, disk space, and exported file systems,
        as well as network connectivity, required processes, disk usage,
        CPU usage, run queues, logins, ftp server status, and SMTP server
        status.
        Available for HPUX 10.20/11.00, IRIX 6, Linux 2.x, Solaris 5.x,
         using Tcl/Tk 8.x (Perl 5.x is optional).
        Currently at version 0.29 .
 Updated: 06/2002
 Contact: mailto:[email protected] (S. Mark Black)

 What: Newsspy
 Where: ftp://134.93.129.91/pub/newsspy/newsspy-1.0.tgz ???
 Description: A Tcl program to connect to a NNTP news server and scan
        article headers for special keywords.  If found, read article
        and append to a file.  Can be invoked from cron.
 Updated:
 Contact: mailto:[email protected] (hofmann)

 What: vcron
 Where: http://www.linux-kheops.com/pub/vcron/vcronGB.html
        http://www.linux-kheops.com/pub/vcron/vcron-1.7.tgz
 Description: A visual cron/at interface, allowing one to view,
        modify, delete and add actions.  Written in Tcl/Tk 8.0 and
        has an inline manual.
 Updated: 09/2001
 Contact: mailto:[email protected] (Daniel Roche)




Expect applications are notorious for behavior that turns mysterious in a cron context. Here [L1 ] and here [L2 ] are comments about the situation.