From owner-freebsd-questions@FreeBSD.ORG Mon May 25 00:45:59 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5086106566B for ; Mon, 25 May 2009 00:45:59 +0000 (UTC) (envelope-from tajudd@gmail.com) Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.26]) by mx1.freebsd.org (Postfix) with ESMTP id 6784C8FC27 for ; Mon, 25 May 2009 00:45:59 +0000 (UTC) (envelope-from tajudd@gmail.com) Received: by qw-out-2122.google.com with SMTP id 3so1567425qwe.7 for ; Sun, 24 May 2009 17:45:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type; bh=tW3c4CTjCPhqqj5ceQNy8o7ftSFFmIko055cP3ys7Mk=; b=B1QkTPlJ4qbjDEYk0XxKJgOybTENhM21U9E54OpfQ+pTZg8hDP2m3ptSLVPDu51EL/ tVzFyi1JUWTac4ulXweqOBXtP2zzcH/4qNRDSrQlSbzX3/X2j42ldBL+Quy+4d+iYMsQ NKVZJJ5iLLVA0+zhVBVsBDhNZpePfZxCigYYw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=dCwJ3FeDxpzw0Wo97B22Y8HsFXrNV+QpbFbj5Ot9+H7+zRKhiKy6QEW92PqxKkbFd9 WQZj9EkPqJzM2Txk9WaYg6NFoTpTUPOr+yxlcQEAHI0jhwbiBTldh0fKmpX6DAU3BIRy UrVX7xDWWASvRhSndfV13pz2wG8JQvL2PwijA= MIME-Version: 1.0 Received: by 10.220.72.79 with SMTP id l15mr5120498vcj.18.1243212358735; Sun, 24 May 2009 17:45:58 -0700 (PDT) In-Reply-To: <1243207862.11905.0.camel@ubuntu> References: <1243136795.29198.42.camel@ubuntu> <1243207862.11905.0.camel@ubuntu> From: Tim Judd Date: Sun, 24 May 2009 18:45:38 -0600 Message-ID: To: Sarah.Varney@marketmentat.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-questions@freebsd.org Subject: Re: Crontab for different ime zones X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 00:46:00 -0000 On Sun, May 24, 2009 at 5:31 PM, GT wrote: > On Sat, 2009-05-23 at 23:41 -0600, Tim Judd wrote: > > > > > > > > > > > I propose the following: > > cron itself has no concept of timezone. it is 'date' that is picking > up > > TZ and reporting as such. Cron's job is so simple is that it wakes up > each > > minute to see if it has work to do, regardless of timezone, or anything > > else. > > > > Yep - I understood that, Tim. > > Thew issue seems to be that cron pays no attention to TZ declarations > that happen AFTER it wakes up - cron does not parse the job times using > the new TZ. > > The thing I am struggling with is that 'date' picks up the changes > imposed by 'TZ=', but then 'cron' parses the next line as if the job > times are interpreted using the server's default TZ. > > I've tried using 'CRON_TZ=' as well as, and instead of, 'TZ=' - to no > avail. > > > What I thought ought to happen is this: > > * 'cron' wakes up; > * 'cron' works through the crontab line by line; > * at line 1 cron changes the TZ to America/NY; > * at line 2 cron reads the job time in the context of having just been > told that it's operating in the NY timezone (thus 45 13 * * * is 1:45 pm > NY time); > . > . > . > * at line 15 cron is told to change the TZ to Australia/Sydney; > * from line 14 onwards, 45 13 * * * is 1:45 pm SYDNEY time. > . > . > . > and so on. > > > > It seems that cron behaves as if it forgets $TZ at each newline within a > given cron instance. > > The silly thing is, with all the time I've wasted pursuing this wild > goose I could have built the required four crontabs, and written the > script to swap them in and out on the appropriate dates. > > (Or I could have spent $100 and bought a shared-hosted server space to > do the Australian-TZ stuff and given it sufficent permission to store > the resultant data in y primary mySQL db...) > > Still, I think it's worth persevering with. I'm certain it can be done. > > > You might want to try some other determining factor, such as a shell > > builtin. > > > > > > Good luck. > > Cheers > How about a jail for America/NY, and a jail for AU/Sydney? that might work. --TJ