Slashdot Mirror


Managing Batch Jobs for Several Time Zones?

sporty asks: "I have one machine, a unix box, that serves many time zones at once. Because of this, everything is stored in GMT. Even the system clock is set relative to GMT. The problem is determining when midnite is. I need to run certain jobs, via cron or similar, so that something runs at midnite in that timezone. Anyone have this situation before?"

4 of 44 comments (clear)

  1. Not enough information by mcdrewski42 · · Score: 5, Interesting

    One unix box. Multiple timezones. Evidently a different script needs to be run for each timezone, since otherwise you'd just run your script every half hour on the half hour...

    Why not set up a set of groups with defined IDs (say maybe 1000 - 1047) for each timezone. Allocate users in the appropriate timezone to those groups

    Run a master script every hour (or half hour) which su's to a dummy member of that group and runs some script. you get some protection from accidentally breaking things by running as root.

    Care to tell us exactly what the obvious solutions don't do? what you're trying to do maybe?

    --
    /* affect != effect */ void affect(int *thing,int effect) { *thing += effect; }
  2. Please, geeks of the world by Anonymous+Cowdog · · Score: 5, Informative

    Don't know if this advice applies to this guy or not, because he might truly have a need to run at exactly midnight. But please, run your cron jobs at randomly chosen times, instead of exactly on the hour. That way we can spread the load (machine and network) better. Thank you, have a nice day.

  3. TZ is your friend by sysadmn · · Score: 4, Informative
    Fun Facts:
    • The TZ environment variable is used to determine how to interpret times.
    • Most shells allow you to set environment variables for a single command by specifying them on the command line

    i.e.
    $ TZ=EST5EDT at 12 am
    ...
    $ TZ=PST8PDT at 12 am
    ...
    $ at -l
    1058932800.a Wed Jul 23 00:00:00 2003
    1058943600.a Wed Jul 23 03:00:00 2003
    --
    Envy my 5 digit Slashdot User ID!
  4. DateTime.pm is your friend by Space_Nerd · · Score: 4, Informative

    Check it out, it converts between timezones automagically, respects daylight savings, and all of the fun stuff.

    It's really a lifesaver, here is a link DateTime.pm

    --
    Everybody has a purpose in life, maybe mine is to lurk in slashdot.