in reply to Controlling Terminal Accuracy

You can use the -t operator to check whether your script is connected to a TTY. At least under my Debian system, I get a positive result (1) for the -t operator for a job started from the console, and nothing for 'crontabbed jobs'.


-- JaWi

"A chicken is an egg's way of producing more eggs."

Replies are listed 'Best First'.
Re^2: Controlling Terminal Accuracy
by steves (Curate) on Oct 02, 2004 at 15:18 UTC

    That's slightly different than the controlling terminal. The controlling terminal (in UNIX) is the terminal the job is associated with for signals, but not necessarily the terminal the job is connected to. For example, running a command pipeline or redirected command from the shell will make the process not have a terminal connected to it, but it will still have a controlling terminal. A cron job will have neither a connected terminal or a controlling terminal. The difference is subtle but can be important for things like daemons.