| Author |
Message |
Tim Jones *nix forums beginner
Joined: 18 Mar 2005
Posts: 24
|
Posted: Thu Jul 06, 2006 8:16 am Post subject:
Separate user timezones for cron, possible?
|
|
|
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
|
Posted: Thu Jul 06, 2006 9:32 am Post subject:
Re: Separate user timezones for cron, possible?
|
|
|
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
|
Posted: Thu Jul 06, 2006 9:51 am Post subject:
Re: Separate user timezones for cron, possible?
|
|
|
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! :)
Cheers,
Tim |
|
| Back to top |
|
 |
Stefaan A Eeckels *nix forums Guru Wannabe
Joined: 04 Mar 2005
Posts: 190
|
Posted: Thu Jul 06, 2006 12:37 pm Post subject:
Re: Separate user timezones for cron, possible?
|
|
|
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!
|
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
|
Posted: Fri Jul 07, 2006 8:07 pm Post subject:
Re: Separate user timezones for cron, possible?
|
|
|
| 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 |
|
 |
|