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
 
Search this Thread
Old 06-20-2013, 10:53 AM   #1
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 385

Rep: Reputation: Disabled
Understanding chkconfig


I typically am told to do something like "chkconfig --levels 235 httpd on" after installing some software. I've always assumed this is so the application starts at boottime. Why isn't the "add" option needed?

I then tried 'chkconfig --list', and received the following. I see how httpd and mysqld show on for 2, 3, and 5, and vsftpd shows on for 2, 3, 4,and 5 which is the default.

I then looked in /etc/rcx.d directories, and I see some symbolic links which point to ../init.d/vsftpd, etc. If a number was included in chkconfig, then there is a S before the symbolic link name, otherwise a K. Then a two digit number follows, then the name (i.e. vsftpd). Maybe the S stands for Start, and K for Kill? What is the difference between the different levels? What are these files in /etc/init.d? I thought all files in /etc were supposed to be text files.

Thank you


Code:
# chkconfig vsftpd on
# chkconfig --levels 235 httpd on
# chkconfig --levels 235 mysqld on
# chkconfig --list
NetworkManager 	0:off	1:off	2:on	3:on	4:on	5:on	6:off
abrt-ccpp      	0:off	1:off	2:off	3:on	4:off	5:on	6:off
abrtd          	0:off	1:off	2:off	3:on	4:off	5:on	6:off
acpid          	0:off	1:off	2:on	3:on	4:on	5:on	6:off
atd            	0:off	1:off	2:off	3:on	4:on	5:on	6:off
auditd         	0:off	1:off	2:on	3:on	4:on	5:off	6:off
autofs         	0:off	1:off	2:off	3:on	4:on	5:on	6:off
blk-availability	0:off	1:on	2:on	3:on	4:on	5:on	6:off
bluetooth      	0:off	1:off	2:off	3:on	4:on	5:on	6:off
certmonger     	0:off	1:off	2:off	3:on	4:on	5:on	6:off
cgconfig       	0:off	1:off	2:on	3:on	4:on	5:on	6:off
cgred          	0:off	1:off	2:off	3:off	4:off	5:off	6:off
cpuspeed       	0:off	1:on	2:on	3:on	4:on	5:on	6:off
crond          	0:off	1:off	2:on	3:on	4:on	5:on	6:off
cups           	0:off	1:off	2:on	3:on	4:on	5:on	6:off
dnsmasq        	0:off	1:off	2:off	3:off	4:off	5:off	6:off
ebtables       	0:off	1:off	2:off	3:off	4:off	5:off	6:off
firstboot      	0:off	1:off	2:off	3:off	4:off	5:off	6:off
haldaemon      	0:off	1:off	2:off	3:on	4:on	5:on	6:off
htcacheclean   	0:off	1:off	2:off	3:off	4:off	5:off	6:off
httpd          	0:off	1:off	2:on	3:on	4:off	5:on	6:off
hypervkvpd     	0:off	1:off	2:off	3:on	4:on	5:on	6:off
ip6tables      	0:off	1:off	2:on	3:on	4:on	5:on	6:off
iptables       	0:off	1:off	2:on	3:on	4:on	5:on	6:off
irqbalance     	0:off	1:off	2:off	3:on	4:on	5:on	6:off
iscsi          	0:off	1:off	2:off	3:on	4:on	5:on	6:off
iscsid         	0:off	1:off	2:off	3:on	4:on	5:on	6:off
kdump          	0:off	1:off	2:off	3:off	4:off	5:off	6:off
ksm            	0:off	1:off	2:off	3:on	4:on	5:on	6:off
ksmtuned       	0:off	1:off	2:off	3:on	4:on	5:on	6:off
libvirt-guests 	0:off	1:off	2:on	3:on	4:on	5:on	6:off
libvirtd       	0:off	1:off	2:off	3:on	4:on	5:on	6:off
lvm2-monitor   	0:off	1:on	2:on	3:on	4:on	5:on	6:off
mdmonitor      	0:off	1:off	2:on	3:on	4:on	5:on	6:off
messagebus     	0:off	1:off	2:on	3:on	4:on	5:on	6:off
mysqld         	0:off	1:off	2:on	3:on	4:off	5:on	6:off
netconsole     	0:off	1:off	2:off	3:off	4:off	5:off	6:off
netfs          	0:off	1:off	2:off	3:on	4:on	5:on	6:off
network        	0:off	1:off	2:on	3:on	4:on	5:on	6:off
nfs            	0:off	1:off	2:off	3:off	4:off	5:off	6:off
nfslock        	0:off	1:off	2:off	3:on	4:on	5:on	6:off
ntpd           	0:off	1:off	2:on	3:on	4:on	5:on	6:off
ntpdate        	0:off	1:off	2:off	3:off	4:off	5:off	6:off
numad          	0:off	1:off	2:off	3:off	4:off	5:off	6:off
oddjobd        	0:off	1:off	2:off	3:off	4:off	5:off	6:off
portreserve    	0:off	1:off	2:on	3:on	4:on	5:on	6:off
postfix        	0:off	1:off	2:on	3:on	4:on	5:on	6:off
psacct         	0:off	1:off	2:off	3:off	4:off	5:off	6:off
quota_nld      	0:off	1:off	2:off	3:off	4:off	5:off	6:off
radvd          	0:off	1:off	2:off	3:off	4:off	5:off	6:off
rdisc          	0:off	1:off	2:off	3:off	4:off	5:off	6:off
restorecond    	0:off	1:off	2:off	3:off	4:off	5:off	6:off
rngd           	0:off	1:off	2:off	3:off	4:off	5:off	6:off
rpcbind        	0:off	1:off	2:on	3:on	4:on	5:on	6:off
rpcgssd        	0:off	1:off	2:off	3:on	4:on	5:on	6:off
rpcidmapd      	0:off	1:off	2:off	3:on	4:on	5:on	6:off
rpcsvcgssd     	0:off	1:off	2:off	3:off	4:off	5:off	6:off
rsyslog        	0:off	1:off	2:on	3:on	4:on	5:on	6:off
saslauthd      	0:off	1:off	2:off	3:off	4:off	5:off	6:off
smartd         	0:off	1:off	2:off	3:off	4:off	5:off	6:off
snmpd          	0:off	1:off	2:off	3:off	4:off	5:off	6:off
snmptrapd      	0:off	1:off	2:off	3:off	4:off	5:off	6:off
spice-vdagentd 	0:off	1:off	2:off	3:off	4:off	5:on	6:off
sshd           	0:off	1:off	2:on	3:on	4:on	5:on	6:off
sssd           	0:off	1:off	2:off	3:off	4:off	5:off	6:off
svnserve       	0:off	1:off	2:off	3:off	4:off	5:off	6:off
sysstat        	0:off	1:on	2:on	3:on	4:on	5:on	6:off
udev-post      	0:off	1:on	2:on	3:on	4:on	5:on	6:off
virt-who       	0:off	1:off	2:on	3:on	4:on	5:on	6:off
vsftpd         	0:off	1:off	2:on	3:on	4:on	5:on	6:off
wdaemon        	0:off	1:off	2:off	3:off	4:off	5:off	6:off
winbind        	0:off	1:off	2:off	3:off	4:off	5:off	6:off
wpa_supplicant 	0:off	1:off	2:off	3:off	4:off	5:off	6:off
ypbind         	0:off	1:off	2:off	3:off	4:off	5:off	6:off

Last edited by NotionCommotion; 06-20-2013 at 10:57 AM.
 
Old 06-20-2013, 11:28 AM   #2
mddesai
Member
 
Registered: Mar 2013
Location: Bengaluru, India
Distribution: Redhat, Arch
Posts: 485

Rep: Reputation: 133Reputation: 133
Usually runlevel 3 and 5 are ideal to start a service. Go through the link. You will figure it out.
Services and Daemons
 
Old 06-20-2013, 11:29 AM   #3
dayid
Member
 
Registered: Apr 2012
Location: Central, FL
Posts: 44

Rep: Reputation: Disabled
Quote:
Originally Posted by NotionCommotion View Post
I typically am told to do something like "chkconfig --levels 235 httpd on" after installing some software. I've always assumed this is so the application starts at boottime.
Not quite. It is to set that service to run in the runlevels you have set - in your case, to make the service 'httpd' run when the system is in runlevels "2", "3", or "5"
Quote:
Originally Posted by NotionCommotion View Post
Why isn't the "add" option needed?
The add isn't needed if chkconfig is already aware of the service. "add" is to "add" a service to be managed - not to "add" a service to a runlevel.
Quote:
Originally Posted by man chkconfig
--add name
This option adds a new service for management by chkconfig.
Quote:
Originally Posted by NotionCommotion View Post
I then tried 'chkconfig --list', and received the following. I see how httpd and mysqld show on for 2, 3, and 5, and vsftpd shows on for 2, 3, 4,and 5 which is the default.
Yep, so when the system is in runlevels 2, 3, or 5 - httpd and mysqld will run. vsftpd will run in runlevels 2, 3, 4, or 5.
Quote:
Originally Posted by NotionCommotion View Post
I then looked in /etc/rcx.d directories, and I see some symbolic links which point to ../init.d/vsftpd, etc. If a number was included in chkconfig, then there is a S before the symbolic link name, otherwise a K. Then a two digit number follows, then the name (i.e. vsftpd). Maybe the S stands for Start, and K for Kill?
Yep - and the number is order - so if you need mysqld to start in runlevel 2 before httpd, you can set that order.

Quote:
Originally Posted by NotionCommotion View Post
What is the difference between the different levels?
That's a big topic to discuss here, but here's this section that summarizes nicely:
Quote:
Originally Posted by http://en.wikipedia.org/wiki/Runlevel
Linux Standard Base specification[edit]
Conforming implementations are not required to provide these exact run levels or give them the meanings described here, and may map any level described here to a different level which provides the equivalent functionality.[1]
LSB 4.1.0
ID Name Description
0 Halt Shuts down the system.
1 Single-user Mode Mode for administrative tasks.[2][2]
2 Multi-user Mode Does not configure network interfaces and does not export networks services.[3]
3 Multi-user Mode with Networking Starts the system normally.[4]
4 Not used/User-definable For special purposes.
5 Start the system normally with appropriate display manager. ( with GUI ) As runlevel 3 + display manager.
6 Reboot Reboots the system.
Quote:
Originally Posted by NotionCommotion View Post
What are these files in /etc/init.d?
They're init files.

Quote:
Originally Posted by NotionCommotion View Post
I thought all files in /etc were supposed to be text files.
They are - if you open them, they're simple text files that tell init what to do when given particular arguments.

Last edited by dayid; 06-20-2013 at 11:31 AM.
 
1 members found this post helpful.
Old 06-20-2013, 11:35 AM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,650
Blog Entries: 2

Rep: Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095
Quote:
Originally Posted by dayid View Post
That's a big topic to discuss here, but here's this section that summarizes nicely:
Quote:
Originally Posted by http://en.wikipedia.org/wiki/Runlevel
Linux Standard Base specification[edit]
Conforming implementations are not required to provide these exact run levels or give them the meanings described here, and may map any level described here to a different level which provides the equivalent functionality.[1]
LSB 4.1.0
ID Name Description
0 Halt Shuts down the system.
1 Single-user Mode Mode for administrative tasks.[2][2]
2 Multi-user Mode Does not configure network interfaces and does not export networks services.[3]
3 Multi-user Mode with Networking Starts the system normally.[4]
4 Not used/User-definable For special purposes.
5 Start the system normally with appropriate display manager. ( with GUI ) As runlevel 3 + display manager.
6 Reboot Reboots the system.
Keep in mind that not all distributions handle the runlevels like this. For example, in Debian and most derivatives runlevels 2-5 are the same and the system starts by default in runlevel 2, in Slackware (starting by default to runlevel 3) the runlevel 4 is used as runlevel 5 does in the list you gave.
 
Old 06-20-2013, 11:38 AM   #5
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 385

Original Poster
Rep: Reputation: Disabled
Thanks dayid, great post.

I am actually starting to understand this whole Linux thing

Will the runlevels apply to Centos?
 
Old 06-20-2013, 01:17 PM   #6
dayid
Member
 
Registered: Apr 2012
Location: Central, FL
Posts: 44

Rep: Reputation: Disabled
Quote:
Originally Posted by NotionCommotion View Post
Will the runlevels apply to Centos?
Yep, although runlevels are slightly tricky across different distributions, as noted:
Quote:
Originally Posted by TobiSGD View Post
Keep in mind that not all distributions handle the runlevels like this.
CentOS does use them in the manner prescribed in the quotation I added from Wikipedia - which is where the link provided by mddesai is useful, since it links to the RHEL documentation about the runlevels:
Quote:
Originally Posted by mddesai View Post
 
Old 06-20-2013, 07:40 PM   #7
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
When in doubt, consult the /etc/inittab file eg on Centos6.4 (I'm running a desktop here)
Code:
cat inittab
# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# System initialization is started by /etc/init/rcS.conf
#
# Individual runlevels are started by /etc/init/rc.conf
#
# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf
#
# Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf,
# with configuration in /etc/sysconfig/init.
#
# For information on how to write upstart event handlers, or how
# upstart works, see init(5), init(8), and initctl(8).
#
# Default runlevel. The runlevels used are:
#   0 - halt (Do NOT set initdefault to this)
#   1 - Single user mode
#   2 - Multiuser, without NFS (The same as 3, if you do not have networking)
#   3 - Full multiuser mode
#   4 - unused
#   5 - X11
#   6 - reboot (Do NOT set initdefault to this)
# 
id:5:initdefault:
Lots of SysAdmin manuals http://www.linuxtopia.org/online_boo...ion_index.html
 
  


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
Why do I get "bash: chkconfig: command not found" when I try to run chkconfig? non-thrash Fedora 10 05-20-2010 01:31 PM
[SOLVED] Where do i get Chkconfig coolgreen1 Slackware 7 05-05-2010 03:39 PM
Chkconfig henkoegema Linux - Software 2 12-19-2009 05:21 AM
chkconfig ?? vonedaddy Linux - Newbie 2 11-08-2007 12:44 AM
Help on chkconfig ztopher Linux - Software 0 04-09-2003 04:29 AM


All times are GMT -5. The time now is 07:29 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration