> > look to see if stdin is a tty. Unix is usually very careful about
who has a
> > "controlling tty" and who does not. In Python, file objects have
an isatty()
> > method that will return True or False.
> >
> > import sys
> > isinteractive = sys.stdin.isatty()
> > if isinteractive:
> > ...
> > els
> If you want to know if your program has been launched from an interactive
> terminal or from a system background process like cron or init, then you
> look to see if stdin is a tty. Unix is usually very careful about who has a
> "controlling tty" and who does not. In Python, file objects have
On 6/3/05, Cedric BRINER <[EMAIL PROTECTED]> wrote:
hi,How
can I know if a script is launched interactively or not because I'd
like to make a script verbose or not depending if it is executed as
interactive or not.eg.If I invoke it in a shell.. then it can be verboseIf it is launched from a crontab
On Fri, 2005-06-03 at 18:45 +0100, Alan G wrote:
> > If I invoke it in a shell.. then it can be verbose
> >
> > If it is launched from a crontab.. then it is less verbose.
>
> You need to check who the process owner is.
>
> That can be done on *Nix by reading the USER environment
> variable. Cr
> If I invoke it in a shell.. then it can be verbose
>
> If it is launched from a crontab.. then it is less verbose.
You need to check who the process owner is.
That can be done on *Nix by reading the USER environment
variable. Cron jobs are usually run under the 'cron' user
I believe.
Hoever
hi,
How can I know if a script is launched interactively or not because I'd like to
make a script verbose or not depending if it is executed as interactive or not.
eg.
If I invoke it in a shell.. then it can be verbose
If it is launched from a crontab.. then it is less verbose.
Ced.
--
Ced