systemctl command that is the same as chkconfig --level

Aaron Konstam akonstam at sbcglobal.net
Sat Jun 18 20:45:20 UTC 2011


On Sat, 2011-06-18 at 10:30 -0400, Tom H wrote:
> On Sat, Jun 18, 2011 at 9:18 AM, Aaron Konstam <akonstam at sbcglobal.net> wrote:
> > On Fri, 2011-06-17 at 19:01 -0400, Sam Varshavchik wrote:
> >> Petrus de Calguarium writes:
> >>
> >>> To start it during this session:
> >>> systemctl start <service name>.service
> >>>
> >>> To start every time you start graphical.target:
> >>> systemctl enable <service name>.service
> >>>
> >>> I'm not sure how you would differentiate between multi-user.target and
> >>> graphical.target.
> >>
> >> This is specified by the service unit. systemd uses a slightly different
> >> paradigm. The service itself knows what system state it should be running
> >> in, by default. Enabling the service puts it as a target for the state.
> >
> > Now II am really confused. How does a service like sshd.service know
> > what system state it is to run  at
> 
> For sysvinit services, it probably looks at the "/etc/init.d/" script headers.
> 
> For example, you have to start the nfs server after installing it.
> 
> "/etc/init.d/nfs" has
> 
> --- 8< ---
> chkconfig - 30 60
> --- >8 ---
> 
> in its "checkconfig" header section and
> 
> --- 8< ---
> Required-Start: $local_fs $network $syslog $rpcbind
> Required-Stop: $local_fs $network $syslog $rpcbind
> Defaul-Stop: 0 1 6
> --- >8 ---
> 
> in its LSB header section.
> 
> Running "systemctl enable nfs" set it up to start in runlevels 2 3 4 5
> and stop in runlevels 0 1 6 in the same way that "chkconfig nfs on"
> would (in fact, since the nfs server's a legacy service, there's a
> message that systemctl's handing over to chkconfig - I've forgotten
> the actual wording).
> 
> Since runlevels 2 3 4 are symlinked to multi-user.target, ...
> 
> For systemd services, it probably looks at the "Unit" section of the
> "*.service" files in "/lib/systemd/system/".

That is certainly useful information.
But: chkconfig --level 35 nfs on

would start on entering runlevel 3 and 5 and not on entering runlevel 2
4. Are you saying you can't arrange to do that in systemd. Is that
considered a step up?
-- 
=======================================================================
Not drinking, chasing women, or doing drugs won't make you live longer
-- it just seems that way.
=======================================================================
Aaron Konstam telephone: (210) 656-0355 e-mail: akonstam at sbcglobal.net



More information about the users mailing list