Re: parse an environment file
On 09/30/2012 08:11 PM, Jason Friedman wrote:
First comment: I don't know anything about an "environment file." An
environment is an attribute of a process, and it's inherited by
subprocesses that process launches. This is not a Python thing, it's an
OS thing, for whatever OS you're running.
> $ crontab -l
> * * * * * env
> This produces mail with the following contents:
In other words, these are the environment variables that cron has, and
that it gives to any children it launches.
> On the other hand
> $ env
> produces about 100 entries, most of which are provided by my .bashrc;
> cron provides only a limited number of environment variables.
Gee, those are variables specific to a particular (bash) shell, so how
would a program launched by cron know about them?
> I want my python 3.2.2 script, called via cron, to know what those
> additional variables are. How?
You'd have to change the environment that cron sees (before login), or
add to the crontab, or /etc/default/cron, or else run some shell from
cron that defines those variables and then runs the application. The
way to do this is specific to whatever OS you're running, and is
irrelevant to Python.
Try googling. For some examples, none of which use Python:
|All times are GMT. The time now is 11:18 AM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.