Find the path of a shell command [POSTPONED]

Peter J. Holzer hjp-python at hjp.at
Sun Oct 16 13:16:34 EDT 2022


On 2022-10-16 17:21:03 +0100, Barry wrote:
> > On 16 Oct 2022, at 04:53, Dan Stromberg <drsalists at gmail.com> wrote:
> > 
> > On Wed, Oct 12, 2022 at 9:57 PM Cameron Simpson <cs at cskk.id.au> wrote:
> > 
> >>> On 13Oct2022 03:25, Paulo da Silva <p_d_a_s_i_l_v_a_ns at nonetnoaddress.pt>
> >>> wrote:
> >>> There is another problem involved. The script, works fine except when
> >>> launched by cron! Why?
[... script deleted ...]
> >> Cron's environment is very minimal. This will show you what's in
> >> it.
> > 
> > Careful.  On some systems if someone restarts the cron daemon, it could
> > pick up a larger environment than after being started on boot.
> 
> That have to a old system that does not use systemd.

Systemd is specific to Linux - and not even used by all Linux
distributions.

> Is there a specific system that still does this?

Not sure. Some Unixes I've used in the past (probably including some
Linux distributions) had this problem. So you had to be a bit careful
when restarting daemons from the command line. I think the sysVinit
system used by most Linux distributions before systemd did clean up the
environment if you used it correctly (but I'm not sure and have no
system anymore to test it). I haven't used Solaris or HP/UX in a long
time (and other Unixes even longer) so I don't know what they do these
days. And I've never used MacOS, I just know that they've used a system
of their own long before systemd.

Anyway he doesn't have to restart cron to add a cron-job (nor for any
other reason during normal operation), so what happens if you manually
restart cron is almost certainly irrelevant for the OP.

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp at hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://mail.python.org/pipermail/python-list/attachments/20221016/6982bca0/attachment.sig>


More information about the Python-list mailing list