> R> When tasks are running from my crontab It send to my mail next
> R> message "/bin/bash: root: command not found", but these tasks
> R> started successfully.

I explained to him in a private message that I thought the per-user
crontab format didn't include the user field, which would make sense
if the shell is trying to pick up on the user name and attempting to
run it as a command.

> If so, this is most typical because cron sets up a very limited
> environment for the program, e.g., a very basic path, while you
> usually has a lot of extra settings in the environment.  

True.

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

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

Anyway, I think intermixing korn shell and bash (or whatever Solaris's
'sh' is, probably Bourne-derived) complicates things unnecessarily. But
your point is valid - cron does run in a more limited environment and the
script it runs should specify needed environment parameters, rather than
rely on what likely won't be there.

> One note: I originally wrote if for Sun Solaris.  I could not find
> anywhere in the linux man pages where it is stated what setting PATH

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

> Peter
------------------------------------------------------------------------
David E. Fox                              Thanks for letting me
[EMAIL PROTECTED]                            change magnetic patterns
[EMAIL PROTECTED]               on your hard disk.
-----------------------------------------------------------------------
 -- 

Reply via email to