[CentOS] chkconfig question

Brian Miller bmiller at fullnote.com
Sat Dec 14 22:12:05 UTC 2013


On Sat, 2013-12-14 at 16:09 -0500, Larry Martell wrote:
> On Sat, Dec 14, 2013 at 4:01 PM,  <me at tdiehl.org> wrote:
> > On Fri, 13 Dec 2013, Larry Martell wrote:
> >
> >> On Fri, Dec 13, 2013 at 5:21 PM,  <m.roth at 5-cent.us> wrote:
> >>> Larry Martell wrote:
> >>>> On Fri, Dec 13, 2013 at 5:04 PM, Reindl Harald <h.reindl at thelounge.net>
> >>>> wrote:
> >>>>> Am 13.12.2013 23:00, schrieb Larry Martell:
> >>>>>> In the docs for chkconfig it says:
> >>>>>> More commonly, the service is off by default on all runlevels, which
> >>>>>> looks like this:
> >>>>>>
> >>>>>> # chkconfig: - 20 80
> >>>>>>
> >>>>>> But services with a chkconfig entry like that are started at boot time
> >>>>>> (e.g. mysql, httpd). So when do they get started?
> >>>>>
> >>>>> when they are enabled with "chkconfig <service> on"
> >>>>>
> >>>>> look at /etc/rc0.d/ to /etc/rc6.d
> >>>>> chkconfig finally creates symlinks there
> >>>>
> >>>> But at what run levels is my question.
> >>>>
> >>>> Looking at mysqd, it has:
> >>>>
> >>>> # chkconfig: - 64 36
> >>>>
> >>>> and I see a S64mysqld link in rc 2, 3, 4, and 5. Why in those 4 dirs?
> >>>> Will all scripts with - in the chkconfig entry be started at those 4
> >>>> levels? How is putting - different from putting 2345?
> >>>
> >>> Runlevel 0 is poweroff. 1 is single user/maintenance mode. 4, well, no one
> >>> actually uses 4. And 6 is reboot. So, once the network's up, text mode and
> >>> X-mode.
> >>
> >> Thanks, but what was I wondering was what is the difference between
> >> putting - and 2345 on the chkconfig entry.
> >
> > The - means that it is not enabled. The 2345 means that it gets started in
> > run levels 2, 3, 4 and 5.
> 
> That's what one would think from the docs, but in fact in both cases
> the service is started in run levels 2, 3, 4, and 5.

The I Think the key word is _default_.  From the man page:
        
        If the service should not, by default, be started in any
        runlevels, a - should be used in place of the  runlevels  list.
        
So _by default_, mysqld is not started in any run level.  If you run
'chkconfig mysqld reset' with the initfile data you show above then
mysqld startup should be disabled, just as if you had run 'chkconfig
mysqld off'.  If instead the string '2345' appeared there instead of '-'
then _by default_ mysqld would start.  

Think of it as controlling the fresh-out-of-the-box on/off state of the
service in question.  Make sense?





More information about the CentOS mailing list