On 2022-10-12 21:51:39 +0100, Paulo da Silva wrote:
> Às 19:14 de 12/10/22, Jon Ribbens escreveu:
> > If you're using subprocess.run / subprocess.Popen then the computer is
> > *already* searching PATH for you.
> Yes, and it works out of cron.
> > Your problem must be that your cron
> > job is being run without PATH being set, perhaps you just need to edit
> > your crontab to set PATH to something sensible.

The PATH in cron includes the directories with standard commands like
"rm" by default. If a cron job doesn't find rm, either
 * rm isn't where it is supposed to be, or
 * PATH has been changed.

> I could do that, but I am using /etc/cron.* for convenience.

That may be a clue. Does any of the /etc/cron.* files set PATH to weird
value?

In any case I find that when debugging such problems it is helpful to
find out what the actual environment is. A simple 

* * * * * nobody echo $PATH >> /tmp/path.$$

should do that.

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | h...@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachment: signature.asc
Description: PGP signature

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to