From owner-freebsd-questions@FreeBSD.ORG Sun May 24 23:31:17 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 C7FCF106567A for ; Sun, 24 May 2009 23:31:17 +0000 (UTC) (envelope-from catch.all@marketmentat.com) Received: from mars.hostupon.com (mars.hostupon.com [67.228.194.3]) by mx1.freebsd.org (Postfix) with ESMTP id A53B18FC20 for ; Sun, 24 May 2009 23:31:17 +0000 (UTC) (envelope-from catch.all@marketmentat.com) Received: from [58.165.26.247] (helo=[192.168.1.100]) by mars.hostupon.com with esmtpsa (SSLv3:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1M8N9k-0007ME-Tg; Sun, 24 May 2009 18:31:15 -0500 From: GT To: Tim Judd In-Reply-To: References: <1243136795.29198.42.camel@ubuntu> Content-Type: text/plain Date: Mon, 25 May 2009 09:31:01 +1000 Message-Id: <1243207862.11905.0.camel@ubuntu> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - mars.hostupon.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - marketmentat.com X-Source: X-Source-Args: X-Source-Dir: 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 Reply-To: Sarah.Varney@marketmentat.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 23:31:18 -0000 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 > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"