Home Blog Music Papers Photography About Me

A Patch to Cron to Allow Multiple Instances With Different Timezones

The Problem

When I launch RealPlayer from cron to listen to and/or record from the BBC, I needed the times to follow British local time (GMT/BST) rather than my local time, or I'd be off by an hour during the EDT/BST switches in the spring and fall, but cron had no concept of non-local timezones and the paths it used couldn't be overridden to allow multiple instances started with different values for the TZ environment variable.

The Solution

I patched cron to include a -t switch that would cause it to use config files and paths with the timezone name included in them, thus allowing two or more instances of cron to run side-by-side, as long as they had different values for TZ. So I can now launch a standard cron as usual with /usr/sbin/cron, and a cron running on London time with env TZ=Europe/London /usr/sbin/cron -t.

The patch is available here.

The full tarball is here.

This verion was derrived from the SuSE 9.1 sources, which are in turn based on Paul Vixie's cron. It should function as a drop-in replacement. It should be easy to use the patch and/or tarball to build RPMs for other systems, as well.

If anyone finds it useful and/or finds any bugs or ways to improve the patch, please let me know and/or send me a patch.

If you found this helpful, consider linking to this page or it's parent index, so more people will be able to find it. Of course comments are welcome. Questions, too; though I'm not a cron guru. See below for my email information.



Best viewed with any browser Last update: April 13, 2005
$Revision: 1.1 $
$Id: cron-tz.html,v 1.1 2005/08/21 08:07:48 andrew Exp andrew $
Andrew Turnquist, andrew@turnquist.name (Click to whitelist yourself)