HPE GreenLake Administration
- Community Home
 - >
 - Servers and Operating Systems
 - >
 - Operating Systems
 - >
 - Operating System - HP-UX
 - >
 - Re: shutdown with timeout
 
Operating System - HP-UX
        1840188
        Members
    
    
        3899
        Online
    
    
        110162
        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
	
		
			
            
                
            Go to solution
        
            
		
		
			
            	
	
		
        
		
	
	
		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
 
07-18-2002 06:09 AM
07-18-2002 06:09 AM
			
				
					
					
						We had a network failure the other day on the link to one node of our two node OPS cluster. The node hang shutting down its instances and the other node's instances froze waiting for the first to finish. There can be any number of reasons why a shutdown immediate fails, but I thought I'd write a safer shutdown script. Unfortunately, it doesn't work. 
#!/usr/bin/ksh
#-----------------------------------------------------------------------------
# Usage : shutdown.sh SID
# Description : shutdown the Oracle Instance for value given in SID
# This script is called by HP/MC packages
#
# stop the database service $1; if it's not dead
# in $2 seconds, kill the pmon process
#
# Execution : must be launched by Oracle User
#-----------------------------------------------------------------------------
if [ $# -lt 2 ] ; then
echo 'Usage: shutkill.sh "SID" "KILLWAIT"'
exit 1
fi
#
# Set the ORACLE_SID to $1 parameter and call oraenv utility to set
# ORACLE_HOME, PATH etc environment variables
# see oraenv utility for more informations
#
ORACLE_SID=$1; export ORACLE_SID
ORAENV_ASK=NO; export ORAENV_ASK
. oraenv
#
# calc process id of pmon
#
PMON=ps -ef | grep ora_pmon_$ORACLE_SID | grep -v grep | cut -c 9-17
#
# shutdown the "SID" instance
#
cat << EOF > $CMDFILE
connect / as sysdba
shutdown immediate
exit
EOF
sqlplus /nolog @$CMDFILE &
shutproc=$!
# check every 10 seconds to see if shutproc finished
waiting=0
sleep 10
while [[ "`ps -p $shutproc | grep -c .`" = 2 ]]; do
sleep 10
waiting=$((waiting+10));
if [[ $waiting -gt $1 ]]; then
echo Waited more than $1 ($waiting)
echo Error in shutdown, killing pmon proc
# kill $PMON
exit 72
fi
done
    
This proc returns:
sh: Syntax error: `(' is not expected.
Help oh generous brahmen!
					
				
			
			
				
			
			
				
	
			
				
		
			
			
			
			
			
			
		
		
		
	
	
	
#!/usr/bin/ksh
#-----------------------------------------------------------------------------
# Usage : shutdown.sh SID
# Description : shutdown the Oracle Instance for value given in SID
# This script is called by HP/MC packages
#
# stop the database service $1; if it's not dead
# in $2 seconds, kill the pmon process
#
# Execution : must be launched by Oracle User
#-----------------------------------------------------------------------------
if [ $# -lt 2 ] ; then
echo 'Usage: shutkill.sh "SID" "KILLWAIT"'
exit 1
fi
#
# Set the ORACLE_SID to $1 parameter and call oraenv utility to set
# ORACLE_HOME, PATH etc environment variables
# see oraenv utility for more informations
#
ORACLE_SID=$1; export ORACLE_SID
ORAENV_ASK=NO; export ORAENV_ASK
. oraenv
#
# calc process id of pmon
#
PMON=ps -ef | grep ora_pmon_$ORACLE_SID | grep -v grep | cut -c 9-17
#
# shutdown the "SID" instance
#
cat << EOF > $CMDFILE
connect / as sysdba
shutdown immediate
exit
EOF
sqlplus /nolog @$CMDFILE &
shutproc=$!
# check every 10 seconds to see if shutproc finished
waiting=0
sleep 10
while [[ "`ps -p $shutproc | grep -c .`" = 2 ]]; do
sleep 10
waiting=$((waiting+10));
if [[ $waiting -gt $1 ]]; then
echo Waited more than $1 ($waiting)
echo Error in shutdown, killing pmon proc
# kill $PMON
exit 72
fi
done
This proc returns:
sh: Syntax error: `(' is not expected.
Help oh generous brahmen!
Solved! Go to Solution.
		2 REPLIES 2
	
	            
            
		
		
			
            
                - Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
07-18-2002 06:22 AM
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
07-18-2002 06:28 AM
07-18-2002 06:28 AM
			
				
					
						
							Re: shutdown with timeout
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						That worked... thanks duuude!
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
		
		
	
	
	
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