On Wed, Oct 12, 2022 at 11:13 AM Paulo da Silva <
p_d_a_s_i_l_v_a...@nonetnoaddress.pt> wrote:

> Hi!
>
> The simple question: How do I find the full path of a shell command
> (linux), i.e. how do I obtain the corresponding of, for example,
> "type rm" in command line?
>
> The reason:
> I have python program that launches a detached rm. It works pretty well
> until it is invoked by cron! I suspect that for cron we need to specify
> the full path.
> Of course I can hardcode /usr/bin/rm. But, is rm always in /usr/bin?
> What about other commands?
>
I like to test my cronjobs with something like:

env - /usr/local/bin/my-cronjob

This will empty out the environment, and force you to set $PATH yourself.

Alternatively, you can "ps axfwwe" (on Linux) to see environment variables,
and check what the environment of cron (or similar) is.  It is this
environment (mostly) that cronjobs will inherit.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to