Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script with stty doesn't run in background

Status
Not open for further replies.
Apr 22, 2002
48
US
Hi,

I've scripts that source the .profile in the beginning of the script. They are usually kicked off via cron and run fine. An error "stty - not a typewriter" goes to the error log but rest of the script runs.

When I try to run the same script manually when connected to a terminal, obviously it runs fine. The problem is if I try to run it manually and try to put it in background, the script just stops at the stty command. It doesn't move forward, it doesn't exit, nothing, just stops.

Is there a way to get around this? Is there a way to check if the script is being run via cron or from a terminal or in BG?

Tks
 
remove any 'stty' settings [or terminal control commands] from your shell startup scripts [.profile, .chsrc etc] and move them to your .login file vlad
+---------------------------+
|#include<disclaimer.h> |
+---------------------------+
 
i agree vlad. unfortunatelly this guy does not use 'csh'
in 'csh' you can check for interactively or not:

if( ! $?prompt ) exit # not interactiv

my be you should check for this in your .profile

case '/bin/tty' in /dev*) # interctiv you can exec 'stty'
;; *) # not, you should not exec 'stty'
;; esac
------------ jamisar
Einfachheit ist das Resultat der Reife. (Friedrich Schiller)
Simplicity is the fruit of maturity.
 
pls: interpret ' as backquote
on this s... pc icannot find it :( ------------ jamisar
Einfachheit ist das Resultat der Reife. (Friedrich Schiller)
Simplicity is the fruit of maturity.
 
Thanks vgersh99. I apologize for not being specific. We use korn shell, so .login is of no help.

Tks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top