LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 05-11-2011, 08:42 AM   #1
guggilamsandeep
LQ Newbie
 
Registered: Apr 2011
Posts: 2

Rep: Reputation: 0
Start-Up Script & Shutdown/Kill Script needed


Hi,

We have couple of application services on Red Hat Linux box. I am planning to have start up script, which will be executed when the server boots up and all the application services mentioned in the script should start after executing the script.

In the same way, a shut down script, which is executed when the server is shutting down and all my application services will stop while server is shutting down.

I have seperate team to deploy this. But we have to provide them the scripts. I am not gud at Linux. Could any one please sent me the sample script that acomplissh my requirements.

Just imagine the application services as below and give me sample script.

arcsight_oracle
arcsight_syslog
arcsight_ips

Thanks in advance

Thanks
Sandeep
 
Old 05-11-2011, 08:58 AM   #2
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
You don't want separate scripts for stopping and starting. You want to create one script, put it in /etc/init.d, and set it up for the proper runlevels with the chkconfig command.

A sample script would look something like this:

Code:
#! /bin/bash
#
# /etc/init.d/arcsight_oracle.sh

#
### BEGIN INIT INFO
# Provides:          arcsight_oracle
# Required-Start:    $remote_fs
# Required-Stop:     $remote_fs
# Should-Start:      $syslog
# Should-Stop:       $syslog
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: arcsight_oracle
# Description:       arcsight_oracle
### END INIT INFO

case "$1" in
  start)
        echo -n "Starting arcsight_oracle"
        /path/to/arcsight.startcommand arguments
        echo "."
        ;;
  stop)
        echo -n "Starting arcsight_oracle"
        /path/to/arcsight.startcommand arguments
        echo "."
        ;;
  *)
        echo "Usage: service arcsight_oracle {start|stop}"
        exit 1
esac

exit 0
Depending on how the dependencies are for those different applications, it may even make sense to put the start/stop commands for all of them in one script, instead of different scripts for each. This would allow you to start them in the right order.
 
  


Reply

Tags
startup



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Question Shell script to shutdown virtual machines. copy, and than start VM simmouk87 Linux - General 3 03-20-2011 03:51 PM
kill the process invoked from a shell script, when the script is killed kskkumar Linux - Software 8 05-23-2007 11:29 AM
bash script: run multiple jobs in bg, & kill them separately? mattengland Programming 1 03-26-2006 05:07 PM
Start-Up/Shutdown Script ptreves Linux - Newbie 1 09-15-2004 04:27 PM
script at xwin start to kill old process(es) butthead Programming 3 02-01-2002 08:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 08:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration