niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
· nixdoc.net · man pages · Linux HOWTOs · FreeBSD Tips · Forums
navigation Forum index » *nix » AIX
Separate user timezones for cron, possible?
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
Author Message
Tim Jones
*nix forums beginner


Joined: 18 Mar 2005
Posts: 24

PostPosted: Thu Jul 06, 2006 8:16 am    Post subject: Separate user timezones for cron, possible? Reply with quote

Hi,

Is it possible to persuade cron to run using a separate timezone for
each user login?

The reason being, we've (temporarily) got two systems running on one
box, one for the UK and one for the US, with cron jobs for both. Ideally
I'd like the time specs in the users crontabs to run as if they were in
the users timezone.

I can't see if this is possible with the supplied cron daemon (for AIX 5.2).

Hope this is possible?

Cheers,

Tim
Back to top
Mark Taylor
*nix forums Guru Wannabe


Joined: 21 Feb 2005
Posts: 292

PostPosted: Thu Jul 06, 2006 9:32 am    Post subject: Re: Separate user timezones for cron, possible? Reply with quote

What job do you run from cron ? if it is a script, then you could set
the TZ variable for each user in thier .profile and then make sure your
script runs the .profile for each specific user before doing its
processing.

Cron by default runs a very limited environment so you have to force it
by specifying your variables in the script you are running or explicity
set them in the crontab before running the script etc..

HTH
Mark Taylor
Back to top
Tim Jones
*nix forums beginner


Joined: 18 Mar 2005
Posts: 24

PostPosted: Thu Jul 06, 2006 9:51 am    Post subject: Re: Separate user timezones for cron, possible? Reply with quote

Hi Mark,

Thanks for the reply...

Mark Taylor wrote:
Quote:
What job do you run from cron ? if it is a script, then you could set
the TZ variable for each user in thier .profile and then make sure your
script runs the .profile for each specific user before doing its
processing.

This would run the script specified in the crontab with the correct
timezone as you say. But, the cron daemon itself will still be running
within the timezone defined in /etc/environment and not the users own.

Quote:
Cron by default runs a very limited environment so you have to force it
by specifying your variables in the script you are running or explicity
set them in the crontab before running the script etc..

Sometimes I really with it didn't! :)

Quote:
HTH
Mark Taylor

Cheers,

Tim
Back to top
Stefaan A Eeckels
*nix forums Guru Wannabe


Joined: 04 Mar 2005
Posts: 190

PostPosted: Thu Jul 06, 2006 12:37 pm    Post subject: Re: Separate user timezones for cron, possible? Reply with quote

On Thu, 06 Jul 2006 09:51:49 GMT
Tim <tim@mr-dog.net> wrote:

Quote:

Mark Taylor wrote:
What job do you run from cron ? if it is a script, then you could
set the TZ variable for each user in thier .profile and then make
sure your script runs the .profile for each specific user before
doing its processing.

This would run the script specified in the crontab with the correct
timezone as you say. But, the cron daemon itself will still be
running within the timezone defined in /etc/environment and not the
users own.

The cron daemon is a common service, so it cannot run in two
timezones. I understand you want to avoid changing the crontab to
compensate for the different timezones, but that would not make cron
run in two timezones either, it would just allow the specification of a
timezone in the user's crontab.

Quote:
Cron by default runs a very limited environment so you have to
force it by specifying your variables in the script you are running
or explicity set them in the crontab before running the script etc..

Sometimes I really with it didn't! Smile

There are very good reasons for not using the user's shell and sourcing
the user's environment, but I agree that for the naive user it can be
counter-intuitive.

You could of course use LPARs. That's what I would do in your
situation, as it would keep the two environments separate.

Take care,

--
Stefaan A Eeckels
--
"There's nothing wrong with Java - well actually there is, but we won't
intrude on private grief here - except that it is pretty presumptuous
and demanding, and shows clear signs of fixation at the anal stage: it
doesn't just throw exceptions, it throws tantrums." --Steve Blinkhorn
Back to top
Bas
*nix forums beginner


Joined: 07 Jul 2006
Posts: 2

PostPosted: Fri Jul 07, 2006 8:07 pm    Post subject: Re: Separate user timezones for cron, possible? Reply with quote

Quote:

Is it possible to persuade cron to run using a separate timezone for each
user login?

The reason being, we've (temporarily) got two systems running on one box,
one for the UK and one for the US, with cron jobs for both. Ideally I'd
like the time specs in the users crontabs to run as if they were in the
users timezone.


Check and see if the system-default cron daemon can be configured to store
its' tabs
in another directory by using command line arguments or environment
settings. This
might only work properly when the crontab command can also be configured ...

You could also try to temporarily install another cron package. This cron
package should
store the users' crontabs in a directory that differs from the original
crond. The users that
require the other timezone should use the crontab that is supplied with the
`other' cron
package. You should then be able to start this `other' crond with TZ set to
the
appropriate timezone. Make sure only the `new' users can use the alternate
cron package
to prevent trouble when the situation is reverted.
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
The time now is Fri Sep 03, 2010 1:45 pm | All times are GMT
navigation Forum index » *nix » AIX
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Postfix Smarthost not relaying mail to Exchange for one user Severian23 Postfix 1 Mon Sep 14, 2009 12:51 pm
No new posts postfix smtp authentication using mysql stored user/pass rtresidd Postfix 0 Fri Oct 03, 2008 5:58 am
No new posts User Environment - export PATH variable paalepu AIX 0 Tue Sep 12, 2006 8:12 pm
No new posts Capturing user login Information of windows sachin PHP 3 Fri Jul 21, 2006 5:44 am
No new posts Recommend an email program for the debian-user-digest? DJ Hackenbruch Debian 5 Fri Jul 21, 2006 3:20 am

Copyright © 2004-2005 DeniX Solutions SRL
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum |  email marketing service
 
Sponsors: Turquoise Jewelry | Free Ecards | Ipod Touch | Breast Enlargement | Car Insurance Quote
Privacy Policy
[ Time: 0.1210s ][ Queries: 17 (0.0903s) ][ GZIP on - Debug on ]