- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Shutdown script to stop a application service
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
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
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
02-08-2012 01:27 PM
02-08-2012 01:27 PM
Shutdown script to stop a application service
Dear frieds
I expect your help in writing a script on rhel5 for below requirement.
On server nxETLd21, please ensure the Informatica services are automatically halted if the server is shut down.
The command to halt Informatica services is:
/eai/apps/informatica/PowerCenter/server/tomcat/bin/infaservice.sh shutdown
Please add the above command to the relevant OS shutdown script.
Basant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2012 07:30 AM
02-09-2012 07:30 AM
Re: Shutdown script to stop a application service
In a RHEL5 system, there is a template for startup/shutdown scripts at:
/usr/share/doc/initscripts-<version>/sysvinitfiles
The file contains explanations and an example script: you'll only need to replace the parts within <angle brackets> with the commands you want. For example, here is the part that actually stops the application:
stop() {
echo -n "Shutting down <servicename>: "
<stop daemons, perhaps with the killproc function>
rm -f /var/lock/subsys/<servicename>
return <return code of stopping daemon>
}
You would replace the <servicename> with the name of your application (which should be the same as the name of the script), and the <stop daemons, perhaps with the killproc function> part with the command given to you:
stop() { echo -n "Shutting down informatica: " /eai/apps/informatica/PowerCenter/server/tomcat/bin/infaservice.sh shutdown RESULT=$? rm -f /var/lock/subsys/informatica return $RESULT }
If you don't actually need to start the application service, you can place a command that does nothing (or just outputs a message) in the place of the application start-up command.
You should also write the tags section at the beginning of the script, for example:
# chkconfig: 345 99 01 # description: This is the shutdown script for Informatica.
(the tags section is explained at the end of the 'sysvinitfiles' file.)
Then save the completed script to /etc/init.d/informatica (or whatever you chose as the service name), and run "chkconfig --add informatica" to automatically create the needed links in the /etc/rc[0-6].d directories.