LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-25-2006, 06:38 AM   #1
raj_deep2k1
LQ Newbie
 
Registered: Jan 2006
Posts: 25

Rep: Reputation: 15
automatic executing shell script at booting


Hello all,
I want to execute automatically a shell script at booting time whenever i start the server.
how can i do this,plz help me in hurry

-rajendra

Last edited by raj_deep2k1; 01-25-2006 at 07:16 AM.
 
Old 01-25-2006, 07:17 AM   #2
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,596

Rep: Reputation: 80
You have 6 levels of boot time.
startup scripts are located in /etc/rc.d/rc%.d (where % is the run level).

/etc/rc.d/rc0.d/ Shutdown
/etc/rc.d/rc1.d/ Single user
/etc/rc.d/rc2.d/ Multiuser (no network)
/etc/rc.d/rc3.d/ Full multiuser - text console
/etc/rc.d/rc4.d/ Reserved
/etc/rc.d/rc5.d/ X fully functional
/etc/rc.d/rc6.d/ Reboot

Create your script in /etc/rc.d/init.d or in /etc/init.d (depending on your distro)
Then add a soft link in each run level to this script. the soft link name must begin with a 'K' or a 'S'. It is starts with a 'K', it means that the service must be stopped in this run level. With a 'S', it must run.
Practically, the init process will run all the scripts localted in the run level directory at each run level with 1 argument. This argument is 'start' or 'stop', depending if the script's first letter is 'K' or 'S'.
 
Old 01-25-2006, 07:22 AM   #3
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,596

Rep: Reputation: 80
If you want something simpler :
Try to find a script in /etc/init.d or /etc/rc.d/init.d where you can add your script at the end.
For instance, if your script is about the network, you probably want it to run in levels 3, 4 and 5. There is probably a network starting script in /etc/init.d probably called network which is probably already soft linked in the right run level directories. Just add a call to your script at the end.
 
Old 01-25-2006, 07:36 AM   #4
raj_deep2k1
LQ Newbie
 
Registered: Jan 2006
Posts: 25

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Agrouf
If you want something simpler :
Try to find a script in /etc/init.d or /etc/rc.d/init.d where you can add your script at the end.
For instance, if your script is about the network, you probably want it to run in levels 3, 4 and 5. There is probably a network starting script in /etc/init.d probably called network which is probably already soft linked in the right run level directories. Just add a call to your script at the end.
thanks a lot
-Rajendra
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
executing konsole from shell script Meriadoc Linux - Newbie 10 07-10-2009 08:08 AM
Executing a shell script command!! vishamr2000 Programming 4 08-15-2005 12:33 AM
Auto-Executing Shell Script on boot benrose111488 Linux - Software 5 12-18-2004 12:52 AM
executing shell script on apache nooodles Linux - General 1 06-29-2004 01:51 AM
executing a shell script from C llama_meme Programming 2 04-01-2002 09:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:48 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