Using xmessage in system cron?

Ryan M Pisani rpisani at csc.com
Mon Sep 20 12:54:11 UTC 2004


                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
   I'm using Enterprise 3 WKS, and I'm trying to create a system cron that  
   monitors aging files for the console  user. The problem I'm having is    
   that I'm unable to access the display when the script executes.          
                                                                            
   I've tried a number of combinations that don't seem to work. For example 
   the                                                                      
   following:                                                               
                                                                            
   I grab the console user as so:                                           
   consoleuser=`ls -al /dev/console | awk {'print $3'}`                     
                                                                            
   Then I attempt to su to the user and display a message back to the       
   console:                                                                 
   (su - $consoleuser -c "export DISPLAY=:0;xhost +localhost;xmessage       
   "whatever"")&                                                            
                                                                            
   No matter what I've tried like setting the xauth file in the user's      
   home. I                                                                  
   cannot access the display. I keep getting a cannot open display error    
   message.                                                                 
   Is there an easier way that I'm missing?                                 
                                                                            
   Just a note, the same script works without a flaw in Fedora Core 1. Has  
   anyone sucessfully accomplished something like this in RedHat Enterprise 
   3?                                                                       
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            









Ryan Pisani







More information about the redhat-list mailing list