How to tell when a script is executed by cron ?

dsavitsk dsavitsk at e-coli.net
Wed Feb 5 04:17:00 EST 2003


"Simon Dobner" <sdobner at scu.edu.au> wrote in message
news:pan.2003.02.05.05.20.31.693008 at scu.edu.au...
> On Wed, 05 Feb 2003 11:41:45 +1100, Simon Dobner wrote:
>
> > I want to know how to tell if a script is being executed in the
background
> > by cron

* * *

> I'd appreciate feedback on this - is it a good idea or have I missed
> something ?

You might also invoke the script with some sort of flag from your crontab,
i.e.

/usr/local/bin/python /path/to/yourscript.py --cron-run

and just check for that.

-d






More information about the Python-list mailing list