- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to run a script during failover?
Categories
Company
Local Language
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
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
Community
Resources
Forums
Blogs
- 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
05-22-2009 12:39 PM
05-22-2009 12:39 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2009 01:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2009 11:45 PM
05-22-2009 11:45 PM
Re: How to run a script during failover?
Normally during the failover the application will be unavailable , that time i don't know how mcsg will works
thanks and regards
Sajjad Sahir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2009 06:19 AM
05-23-2009 06:19 AM
Re: How to run a script during failover?
You can use the customer_defined_halt_commands section in the package control script to execute any command or script during package shutdown(remember these script will be executed during normal package shut down and fail over ).
If you just need to execute the script during fail over not during pkg shutdown ,then u may need to add additional functionality such as create an application monitoring script and let the monitoring script to call the application start/stop script with a different argument for each scenario to handle the pkg shutdown and fail over differently.(just thought may not be simple though)
Thanks!
Johnson
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2009 06:36 AM
05-23-2009 06:36 AM
Re: How to run a script during failover?
As others have already suggested, the package control script would be the correct place for it. I would suggest not putting it in the customer_defined_halt_commands as that wouldn't be guaranteed to run. If, for example, the primary node dies, the package never does a clean shut down.
You can put logic in the customer_defined_run_commands to determine what node the package is running on. If it's the primary node, then no failover and you don't do anything. If it's the adoptive node, then run whatever you wanted to run for the failover.
Something like the following:
check_node()
{ Primary=hostA
Alt=hostB
Host=$(hostname)
if [ "${Host}" = "${Alt}" ]
then
echo "Running on adoptive node - alerting X about failover"
... cmnds opcmsg, email, whatever else you want to do.
fi
}
funcion customer_defined_run_commands
{ check_node
... remainder of the normal function
}
Hope that helps.
Doug
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2009 06:42 AM
05-23-2009 06:42 AM
Re: How to run a script during failover?
Let's say you create a file:
# touch /etc/cmcluster/${PKG_DIR}/runnning
and check this file for existence. If it's there then the package should be running, so the stopping of the package is a failover, let's run that script!
if [ -f /etc/cmcluster/${PKG_DIR}/runnning ]
then
print "Hey, it's a FAILOVER!"
fi
Unix operates with beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2009 06:45 AM
05-23-2009 06:45 AM
Re: How to run a script during failover?
# rm /etc/cmcluster/${PKG_DIR}/runnning
Unix operates with beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2009 07:07 AM
05-23-2009 07:07 AM
Re: How to run a script during failover?
I do agree ,But in A TOC condition will there be a chance executing any other script ???
>>You can put logic in the customer_defined_run_commands to determine what node the package is running on. If it's the primary node, then no failover and you don't do anything. If it's the adoptive node, then run whatever you wanted to run for the failover.
I hope u have suggested to run the script on the primary node during the pkg startup on adoptive node (from adoptive node call the script to run on primary)
Again..In the TOC condition will the primary node be available for executing the fail over script??This will rather create a mess and affect the package start up on the adoptive node !! correct me if i get u wrong
Thanks!!
Johnson
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2009 08:24 AM
05-23-2009 08:24 AM
Re: How to run a script during failover?
If the package starts on the primary node, the customer_defined_run_commands gets run, which then runs check_node. That function doesn't do anything because the package is running on the primary node.
Now, if the primary node crashes, after a few seconds, the package starts running on the adoptive node. It gets to the customer_defined_run_commands which then runs check_node, which then does whatever is desired because ${Host} = ${Alt}.
Basically, nothing's checked on the way down - only on the way up because you can't guarantee *how* the package is coming down.
Does that clear it up?
As other additional posts have also indicated, there's 100s of ways to skin this particular cat. That's the nice thing about UNIX; there's usually several *rgith* ways to do the same thing.
Hope that helps.
Doug O'Leary
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html