Solved

init configuration : controlling the services and daemons starting at boot time.

Posted on 2004-04-07
13
364 Views
Last Modified: 2013-12-15
I have Red Hat Linux 8.0 installed on a standalone P-4 workstation, having 128 MB RAM and 120 GB Hard disk. My question is :----

Which file within the system contains the configuration that determines what are the services/daemons that get stared at the time of startup?What is its relationship with init and /etc/inittab ? (e.g. on my system, it gives messages like Starting lpd, Staring xinetd, Starting APM Daemon, Starting anacron, Starting cannaserver ....... and many more, followed by[OK]). Also please tell me about its location.(is it /etc/init.d/rc.sysinit ?).

I would also like to know, if it conains a human readable list of services and their starting order and if so, is it possible to delete one of these entries or comment them out so that the service does not startup during boot time?(e.g. I don't have a printer and do not want the lpd daemon to start). If not, then how to stop/prevent some of these services from getting started during startup?(like we can run msconfig in windows systems and can opt for a selective startup).

 Is it safe enough to edit this configuration file? Are there any precautions to be ovserved before editing it? Please help me out as I cannot locate the configuration files, even after reading the man entries for init and tellinit. As this qusetion shows, i am a relatively new linux user and don't yet know my way around.Pl. help.
0
Comment
Question by:ray_pro2
13 Comments
 

Author Comment

by:ray_pro2
ID: 10778676
It will be extremely nice of you if you can give my installation specific answers(in my case please give the location of all files relative to Red Hat Linux 8.0 full installation vaersion - I am most interested in the location of the config. file) as there are variation of locations among the  distributions and sometimes even among versions.
0
 
LVL 17

Expert Comment

by:owensleftfoot
ID: 10779481
All the processes which get started at boot are scripts in the /etc/init.d directory. But not all of them start every boot :) There are a  series  of  rc directories in the /etc directory. rc1.d contains links to the the scripts in /etc/init.d/ which are started when linux boots in runlevel 1. /etc/rc3.d contains links to the the scripts in /etc/init.d/ which are started when linux boots in runlevel 3.
The links in these directories either start with a capital S (start) or a capital K (kill). The links which run at startup begin with S. The links which run at shutdown begin with K (kill).
0
 
LVL 40

Expert Comment

by:jlevie
ID: 10779565
From the command line you can see the list of services started at boot with 'chkconfig --list'. Processes in that list can be disabled with 'chkconfig proc-name off' or enabled with 'chkconfig proc-name off'
0
 
LVL 12

Expert Comment

by:mburdick
ID: 10791244
The answer to your questions are:

1) There is no one file that contains all of the information about which services start at which runlevels. All of the daemon init scripts are contained in /etc/init.d, and the different runlevels are defined by subdirectories under /etc/init.d. Look for /etc/init.d/rcX.d where X is the runlevel that you want to see. All of the "files" in that directory are actually symbolic links back to the original scripts in /etc/init.d. The names will be represented as a combination of three pieces. The first character will be S or K (Start or Kill). The next two characters are a number that determines in what order, relative to other services, this one will be Started or Killed. The remaining characters are the name of the daemon, and will be the same as the original daemon script name in /etc/init.d.

2) The relation between daemons started at boot time and /etc/inittab is that the /etc/inittab file includes a line like   id:3:initdefault:    This tells the system what runlevel to enter when it boots up (3, in this case). Look at your /etc/inittab and determine your default runlevel. Once you know that, you can inspect the appropriate /etc/init.d/rcX.d directory to determine what services are configured to start or stop at that level.
0
 

Author Comment

by:ray_pro2
ID: 10793626
Dear mburdick, you almost answered my question. But please tell me which binary file/shell script (along with its location) is responsible for starting up all the services, whose shortcuts are provided in the directory /etc/init.d/rcX.d ?
0
 
LVL 12

Expert Comment

by:mburdick
ID: 10793692
There is no single program or script. The boot process searches the appropriate runlevel directory and executes each of the scripts in turn.

Is there something in particular you are trying to accomplish? Maybe the way you're asking is just confusing me...
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:ray_pro2
ID: 10793701
Yes one more thing - is it proper (i.e. safe) to remove one of these shortcuts from /etc/init.d/rcX.d to prevent that service from starting up at boot time? Or should I try renaming by prefixing it with K in case it starts with S so that it does not start running at startup?

Also, does the /etc/inittab file do nothing else but determine the runlevel. There so much more in it. What does the rest of the script do? The last line starts the xdm (by using the script-command prefdm -nodaemon), of course my runlevel is 5. If I make my runlevel 3, then does this line autometically gets deleted/commented out ?
0
 
LVL 12

Expert Comment

by:mburdick
ID: 10793742
/etc/inittab does do other things. Specifically, it control *some* of the services that run (and how) at certain runlevels, like the display manager. If you change your runlevel to 3, xdm simply won't run becuase it's configured to run at runlevel 5.

If you want to remove a specifc link file from one of the runlevels, you *can* delete the file. But, that could cause problems. If you want to take it out of a particular runlevel, run    chkconfig  -levels <X> <service> off   and substitue the runlevel you want to change for X and the daemon for service. If you want to start a service, change the off to on.
0
 

Author Comment

by:ray_pro2
ID: 10793780
Dear mburdick, just now I saw your comment. Thank you for being patient(even if I am confusing). Yes there is someting particular I am trying to accomplish -- I am trying to control manually the services that get started up during startup, particularly I want some of them not to startup at all. Hoe do I achieve that safely? Hope my intensions are clear enough to you now.
If you mind answering, then please be kind enough to mention the name of any configuration files, so that I can read them(and if possible, edit them) to understand my system better. Thanx so far.
0
 

Author Comment

by:ray_pro2
ID: 10793831
I got your next comment. Please understand that I have no intension whatsoever of changing my runlevel - as I am very happy with mine. I only want to control the services that startup in the beginning (and that too without changing my runlevel. e.g. how do I manage not to let the service lpd get started at boottime, keeping the runlevel and other services intact?)

It might sound like a digression, but does xfs get started up only if the runlevel is 5?(Please don't be confused - it is only a related question.)
0
 
LVL 12

Accepted Solution

by:
mburdick earned 250 total points
ID: 10793849
If you're working from a shell, use the command chkconfig to add and remove services from startup. If you're working in the GUI, use redhat-config-services (you can run this from a prompt from within the GUI).

You should only disable services that you are absolutely certain you don't need. And, you might want to disable them one at a time and reboot in between (just in case).
0
 

Author Comment

by:ray_pro2
ID: 10793990
Dear mburdick, I have just run chkconfig and redhat-config-services. It really has been a great help as they have done exactly what I wanted to do. Thank you. I accept Your answer. But before I do that, one last thing. How are these changes implemented?(I mean, if I switch the service on/off using the command chkconfig, which file does the system write to, such that the change is enforced? ) Simply, tell me the name(+location) of the configuration file, that is operated on while one makes these changes.(Both these commands appeared to me as mere front ends, particularly the second one. As you can see, I am a little interested about what goes behind the scene. So please be a little more helpful. You have already been a great help.)
0
 
LVL 12

Expert Comment

by:mburdick
ID: 10794450
Again... there is no configuration file.

If a service is to be started at runlevel 3, a link is inserted into /etc/init.d/rc3.d

If you later decide that service shuold not be started at runlevel 3, the link is deleted.

There is no one confguration file. The existence or absence of a link is what determines if a service is started or not.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now