HPE GreenLake Administration
- Community Home
 - >
 - Servers and Operating Systems
 - >
 - Operating Systems
 - >
 - Operating System - Linux
 - >
 - Re: Facing problem in Expect scripting. <Suggest a...
 
Operating System - Linux
        1840141
        Members
    
    
        2393
        Online
    
    
        110161
        Solutions
    
Forums
        Categories
Company
Local Language
                
                  
                  back
                
        
                
        
                
        
                
        
        
        
                
        
                
        
        
        
                
        
              
              Forums
Discussions
Forums
- Data Protection and Retention
 - Entry Storage Systems
 - Legacy
 - Midrange and Enterprise Storage
 - Storage Networking
 - HPE Nimble Storage
 
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
                
                  
                  back
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
            
                
            
                
            
                
            
                
            
            
                
            
                
            
            
                
            
                
              
            Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
 - Appliance Servers
 - Alpha Servers
 - BackOffice Products
 - Internet Products
 - HPE 9000 and HPE e3000 Servers
 - Networking
 - Netservers
 - Secure OS Software for Linux
 - Server Management (Insight Manager 7)
 - Windows Server 2003
 - Operating System - Tru64 Unix
 - ProLiant Deployment and Provisioning
 - Linux-Based Community / Regional
 - Microsoft System Center Integration
 
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
        Information
        Community
Resources
Community Language
        Language
        Forums
Blogs
Topic Options
			
				
					
	
			
		
	- Subscribe to RSS Feed
 - Mark Topic as New
 - Mark Topic as Read
 - Float this Topic for Current User
 - Bookmark
 - Subscribe
 - Printer Friendly Page
 
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
02-26-2009 02:19 AM
02-26-2009 02:19 AM
			
				
					
						
							Facing problem in Expect scripting. <Suggest any alternative to Sleep command>
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						I am writing an expect script (executing on linux) to automate the BACKUP/RESTORE system disk on the OpenVMS.
------------------------------------------
i.e below piece of code works properly if the sleep time provided is sufficient to complete BACKUP/RESTORE.
send "Backup ...\r"
sleep sleep_time
expect -re $R_prompt
------------------------------------------
Time to complete the execution of command varies based on the size of data. So there may be head ache of calculatin exact time required for the execution. (if sleep time provided is less than the time required for execution, then the expect fails..)
So is there any alternative way for this. I even tried with while{} loop which fails to break after execution (as below),
------------------------------------
send "BACKUP/IMAGE ...\r"
while {1} {
expect {
-re $R_prompt {
break;
}
}
}
------------------------------------
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
		
		
	
	
	
------------------------------------------
i.e below piece of code works properly if the sleep time provided is sufficient to complete BACKUP/RESTORE.
send "Backup ...\r"
sleep sleep_time
expect -re $R_prompt
------------------------------------------
Time to complete the execution of command varies based on the size of data. So there may be head ache of calculatin exact time required for the execution. (if sleep time provided is less than the time required for execution, then the expect fails..)
So is there any alternative way for this. I even tried with while{} loop which fails to break after execution (as below),
------------------------------------
send "BACKUP/IMAGE ...\r"
while {1} {
expect {
-re $R_prompt {
break;
}
}
}
------------------------------------
		2 REPLIES 2
	
	            
            
		
		
			
            
                - Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
02-26-2009 05:41 AM
02-26-2009 05:41 AM
			
				
					
						
							Re: Facing problem in Expect scripting. <Suggest any alternative to Sleep command>
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						> [...] automate the BACKUP/RESTORE system
> disk on the OpenVMS.
What is there to automate? One BACKUP
command? Why sleep for any particular amount
of time? Why not simply wait for the command
to finish (and the next prompt to appear)?
Is there some actual problem which you are
trying to solve?
(Or will your script load a second tape into
the tape drive when the first one is full?)
You're connected to the VMS system how,
exactly? Serial line, Telnet/rsh/ssh, what?
		
		
	
	
	
> disk on the OpenVMS.
What is there to automate? One BACKUP
command? Why sleep for any particular amount
of time? Why not simply wait for the command
to finish (and the next prompt to appear)?
Is there some actual problem which you are
trying to solve?
(Or will your script load a second tape into
the tape drive when the first one is full?)
You're connected to the VMS system how,
exactly? Serial line, Telnet/rsh/ssh, what?
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
03-02-2009 03:23 AM
03-02-2009 03:23 AM
			
				
					
						
							Re: Facing problem in Expect scripting. <Suggest any alternative to Sleep command>
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						My problem is not at the VMS end, but at the linux Expect scripting.
"(Other than using sleep method)How to wait for the sent command for long time (may be more than an hour)? "
I am connecting to VMS from linux box through telnet (to be specific, using expect script on linux).
Thanks
Suresh
		
		
	
	
	
"(Other than using sleep method)How to wait for the sent command for long time (may be more than an hour)? "
I am connecting to VMS from linux box through telnet (to be specific, using expect script on linux).
Thanks
Suresh
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
		
	
	
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP