On June 22, 2001, David E Fox wrote:

PMN> env -i HOME=$home LOGNAME=$logname PATH=$path SHELL=$shell
PMN> /usr/bin/sh -x $*

DEF> Or in bash, 'export .... ' :)

No.  I used the command env with the -i to make sure to clear the
current environment.  The whole point of the script is to give you the 
same environment as when the script is run by cron.  Using export
gives you the current shell environment plus what you have exported.

DEF> Anyway, I think intermixing korn shell and bash (or whatever
DEF> Solaris's 'sh' is, probably Bourne-derived) complicates things
DEF> unnecessarily. 

Again, this script was written to exactly mimic the behavior of cron;
on solaris the man page explicitly states that cron command is passed
as an command argument to sh.  I checked the linux man page the other
night, and as I recall the default behavior there boiled down to sh
again. 

DEF> AFAIK, it's just another process (at least true of 'cron') so it,
DEF> like any other process, it has a completely independent
DEF> environment. Such things like PATH can be set explicitly and will
DEF> be true of only the current process.

True, the only thing to be aware of is that cron's PATH is whatever
(probably not that big) path is used at system boot when crond is
started.   (That is of course unless you use an explicit setting of
the PATH in your crontab.)

Best

Peter
-- 
http://cs-people.bu.edu/turtle/contact.html
``Deserves death! I daresay he does. Many that live deserve death. 
And some that die deserve life. Can you give it to them?  
Then do not be too eager to deal out death in judgement.'' -- Tolkien

Reply via email to