LinuxQuestions.org
Visit Jeremy's Blog.
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
 
Search this Thread
Old 10-29-2002, 01:32 PM   #1
fowlerlfc
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, 01:55 PM   #2
mirkokl
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, 03:02 PM   #3
adam_boz
Member
 
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:

#/bin/bash
mke2fs /dev/hda1


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


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


All times are GMT -5. The time now is 02:03 AM.

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