On 29/09/11 12:52:22, Steven D'Aprano wrote:

[steve@sylar ~]$ python -c "import sys,os; print os.isatty(sys.stdout.fileno())"
True
>
If I run the same Python command (without the setsid) as a cron job, I
get False emailed to me. That's the effect I'm looking for.

In that case, all you need to do is redirect stdout:

$ python -c "import sys, os
> print os.isatty(sys.stdout.fileno())" >/tmp/xxx
$ cat /tmp/xxx
False

You'll probably want to redirect to /dev/null and
maybe you want to redirect stdin and stderr as well.

-- HansM
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to