CAN'T RUN STTY COMMAND WITHIN A CRON JOB

ITEM: RTA000028639



QUESTION:                                                                       
I am trying to run a backup script via cron that runs                           
the /etc/profile in order to properly setup the PATH.  When I run it            
under AIX it stops at the stty intr '¬?'.  There are two processes              
spawned for the stty commands.  If I run this script on another system,         
it runs fine.  Can you tell me why this is ?                                    
                                                                                
---------- ---------- ---------- --------- ---------- ----------                
A: Since the script is started by cron there is no terminal associated          
   with the process.  You would normally get a mail message from the cron       
   daemon with an error message such as "stty: TXGETLD, the specified           
   device does not exist"; however, if the error messages from                  
   /etc/profile are being sent to /dev/null (". /etc/profile 2>/dev/null"       
   no mail message will be delivered to the user.                               
                                                                               
   I assume that the script runs fine from the command line as opposed          
   to being run from cron...                                                    
                                                                                
   One workaround to this situation would be to place a test similar to         
   the following around the stty and other terminal related commands in         
   your /etc/profile.  The test shown below will allow the stty commands        
   and TERM environment variable assignments to be performed only if the        
   process has a terminal associated with it.                                   
                                                                                
   if . -n `tty`.                                                               
   then                                                                         
     TERMCAP=/usr/informix/etc/termcap;export TERMCAP                           
     #set special chars                                                         
     stty intr '.?'                                                             
     stty echoe                                                                
     stty quit '. '                                                             
                                                                                
     if . `tty` = "/dev/tty0" .                                                 
     then                                                                       
       TERM=ibm3151                                                             
     else                                                                       
       TERM=wyse50                                                              
     fi                                                                         
     export TERM                                                                
   fi                                                                           
                                                                                
---------- ---------- ---------- --------- ---------- ----------                
                                                                                
                                                                                
This item was created from library item Q617302      BZCGL                     
                                                                                
Additional search words:                                                        
BZCGL CMD COMMAND CRON EXECUTE FEB93 IX JOB OP PROFILE RISCOSO                  
RISCSYSTEM RUN SOFTWARE STTY SYS TERM TERMINAL WITHIN                           
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                               


WWQA: ITEM: RTA000028639 ITEM: RTA000028639
Dated: 11/1996 Category: RISCOSO
This HTML file was generated 99/06/24~12:43:10
Comments or suggestions? Contact us