crontab entry environment variables [PSARC/2007/503 FastTracktimeout09/10/2007]
Chris Gerhard
chris at thegerhards.com
Wed Sep 12 09:35:34 PDT 2007
Roland Mainz wrote:
> Chris Gerhard wrote:
>> Roland Mainz wrote:
>>> Darren J Moffat wrote:
> [snip]
>>> 2. I have great concerns about the abuse of the global environment
>>> variable namespace - sooner or later this will backfire _badly_ if cron
>>> and other applications have slightly different ways to interpret the
>>> values.
>> It would if they did. However since cron is interpreting all the
>> variables in the way you expect I fail to see how this is an issue. TZ
>> is treated as the timezone. If we went with .cron.tz cron would still
>> have to set TZ to match this otherwise you would have a cron job wiht
>> .cron.tz set to PST but running on a system in UTC would have the job
>> seeing time as UTC while scheduled in PST.
>
> Two issues:
> 1. You basically assign a double-functionality to the variables - they
> affect both cron internal behaviour and they are exported into the
> environment of the launched cron job.
> For example: What do you want to do if you use the timezone "a" for the
> cron entries but run the cron job with the default system timezone ?
With a crontab entry like this:
TZ=UTC
* * * 7 * env TZ=PST .....
>
> 2. The scheme as described in the current ARC materials is not
> extensible since you can't gurantee that you won't create namespace
> clashes between variables which set/define cron-internal behaviour and
> stuff which is exported into the environment (imagine you add a variable
> called "VERSION" to define which version of the cron spec should be used
> to interpret the cron entries - this would render the OS/Net build
> defunct since environment variables override Makefile variables and
> usr/src/Makefile.master contains a variable "VERSION" ... or short:
> *BOOOOOM* ...).
> Maybe you could say you only export a defined subset of these variables
> (e.g. "SHELL", "HOME", "TZ") but that would make these other variables
> more or less "local variables" and by the usual Unix shell conventions
> such variable names should be at least spelled using lowercase
> characters...
I do. The only variables I export are SHELL, HOME and TZ since they are
the only ones that effect cron. It does not allow the setting of any
other variables.
--chirs
More information about the opensolaris-arc
mailing list