How to tell when a script is executed by cron ?

Grant Edwards grante at visi.com
Thu Feb 6 15:01:11 EST 2003


In article <pan.2003.02.06.01.34.45.427434 at scu.edu.au>, Simon Dobner wrote:
> On Wed, 05 Feb 2003 06:24:02 +0000, Grant Edwards wrote:
> 
>> You can also use
>> 
>>  if os.isatty(sys.stdout.fileno()):
>>       # we're running interactively
>>  else:
>>       # batch mode
> 
> Cool.
> 
> Is os.isatty somewhere in the docs, and I just can't find it, or is it
> covered by this sentence

The former:  http://python.org/doc/current/lib/os-fd-ops.html

It's between ftruncate() and lseek().  ;)

-- 
Grant Edwards                   grante             Yow!  An Italian is COMBING
                                  at               his hair in suburban DES
                               visi.com            MOINES!




More information about the Python-list mailing list