LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
LinkBack Search this Thread
Old 09-15-2004, 03:35 PM   #1
ptreves
Member
 
Registered: Jun 2004
Location: Montreal
Distribution: Red Hat 8
Posts: 120

Rep: Reputation: 15
Unhappy Start-Up/Shutdown Script


Hello,

Working on a Red Hat Enterprise 3 (ES) server, I want to lauch a number of application at start-up time and close them in case of a server shutdown.

In what file should I add these start-up commands and where should such a file be located ?

PT

PS: I have a Database startup/shutdown script located in /etc/init.d/dbora.
I want to do the same with a few other applications.
 
Old 09-15-2004, 04:27 PM   #2
scottman
Member
 
Registered: Jul 2004
Location: USA
Distribution: Slackware, FreeBSD, LFS
Posts: 72

Rep: Reputation: 15
You should be able to put any script you write in /etc/init.d and have it loaded
on startup, and stopped on shutdown. You just need to use a case statement
to make it accept start, and stop. You can then set all your
startup commands to be executed when it recieves the start command. To add
commands for shutdown, have them under your stop command.

The reason this works is that /etc/rc.d/rc (on my Fedora system)
executes these scripts with a start or stop command, depending on
startup or shutdown. Most allow restart, reload, or other commands.

Here is an incomplete example, if you look at scripts in that file, you will
see that most adhere to certain standards, or are just function files.

Code:
#!/bin/bash
case $1 in
        start)
                STARTUP COMMAND1
                STARTUP COMMAND2
                STARTUP COMMAND3
        ;;
        stop)
                SHUTDOWN COMMAND1
                SHUTDOWN COMMAND2
                SHUTDOWN COMMAND3
        ;;
 esac
You could also add your commands to an existing script that gets executed.

/etc/rc.d/rc.local is also common place to add startup commands
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
script at the shutdown dominant Suse/Novell 4 10-15-2005 07:43 AM
shutdown script acidjuice Slackware 3 04-09-2005 05:19 PM
Shutdown script Hexane Mandriva 7 01-28-2005 01:36 AM
shutdown script Zolan Linux - Newbie 2 10-16-2004 09:02 PM
How to start a Tcl/Tk script by simply invoking the script file itself ? cyu021 Programming 2 10-10-2004 11:00 AM


All times are GMT -5. The time now is 08:04 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration