Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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
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
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
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
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
What are these files in /etc/init.d?
They're init files.
Quote:
Originally Posted by NotionCommotion
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.
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.
Yep, although runlevels are slightly tricky across different distributions, as noted:
Quote:
Originally Posted by TobiSGD
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:
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:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.