Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 10-29-2002, 02:32 PM   #1
LQ Newbie
Registered: Jul 2002
Posts: 13

Rep: Reputation: 0
setting script to run when system enter init 3

I'ver written a little script that starts several services. I would like this script to run whenever the system goes into runlevel 3. How do I set this up? and would I need to write a script that gracefully shuts down these services when the machine shutsdown?

Any help is greatly appreciated!
Old 10-29-2002, 02:55 PM   #2
LQ Newbie
Registered: May 2002
Posts: 20

Rep: Reputation: 0
First, check whether the scripts already exist. Normally they are located at /etc/init.d. Some distros use a central configuration file for activating services at boot time.

If not, create new scripts, best one script per service. Use the scripts of your distro, copy and modify them. They aren't just start scripts, but also stop or display the status, you use them by entering: /etc/init.d/example start
/etc/int.d/example stop

Now look for the subdirectories. Search for a script which is started on entring runlevel 3 and stopped on rl 1. Look for the according scripts in rc3.d and rc1.d.

You ought to find a copy of the script in rc3.d and in rc1.d or a symbolic link. These have the name S??example and K??example. S... is used for starting when entering the runlevel and K... for stopping. Check this and ask if anything stays unclear, as your computer might hang on boot or shutdown when you make a mistake.

Enter the links for your script, as said, if they aren't already there.
Old 10-29-2002, 04:02 PM   #3
Registered: Jul 2002
Location: Santa Cruz, CA
Distribution: lfs
Posts: 538

Rep: Reputation: 30
... and make sure it's execable. If you don't want to deal w/ linking it, you can just put it in /etc/rc.d/rc3.d/ as
S##<name> . You don't really need to add all that start-stop stuff, it can be as simple as:

mke2fs /dev/hda1

hehe... just kidding (but it can be that simple)


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
/etc/X11/xinit/.Xmodmap; run level 4 won't init script Potatopopper Slackware 5 11-27-2005 08:37 PM
Redhat linux9.0:System hangs,if gives init 3 or init 4 Sailaja Reddy Linux - Newbie 4 09-16-2004 04:19 AM
"Disk boot failure. Enter system disk and press enter" Fear58 Linux - Hardware 3 06-25-2004 06:17 PM
init script won't run at log-off dimangi Linux - Newbie 1 10-29-2003 03:19 AM
I wants to run the script(xx) while restart the system. help pls... fmohideen76 Linux - General 2 07-11-2002 02:15 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:42 AM.

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