Hey guys and welcome back. So in the previous nuggets we had talked about how we could modify
our run levels. We could use the command init as well as tell init which would be the preferred
method and as opposed to being able to change our particular run level we could also modify what
particular services were starting or stopped during a particular run level. Now the way we
actually saw this was by renaming simlinks. So we would ultimately move a particular simlink to
rename it and if it started with an s we could change it to begin with a k and ultimately modify
the behavior. Now this is not the most practical way to do such a thing and we do have different
commands that we can use to ultimately modify and determine when services are started or stopped.
Now we have two commands the first one is called check config or chk config. This command is going
to be based on red hat based systems so on your Ubuntu machine this command is not going to be
present instead if you're using a debian based machines such as ubuntu or ubuntu the command
we're going to use instead will be update in fact let me just write that a little bit clearer hyphen
rc.d now this actually looks like a directory but no indeed this is actually the command you would
use on a debian based system so right now I want to demonstrate the check config command and as we
know this is not available on a debian based system so what I've actually done in the meantime is
I've actually booted up a rocky linux distribution which I have on my computer now rocky linux happens
to come from red hat so because it is red hat based we're going to have the check config command so
if I go into the man page for check config we can see this utility updates in queries run level
information for system services now we have all of these different options we can go through
but one thing I will say is that when we try to use this command such as check config dash
dash list in fact I would help if I could type this correctly so check config notice we have
some crucial information it says here the sysv configuration data might be overridden by the
native system d pretty much what I'm saying is that whilst this command is actually available here
we have a man page for it because we are now using modern system d we're actually not really getting
the outputs from the check config dash dash list option which is a little bit unfortunate like I say
this is a bit of a problem when we're dealing with such old legacy based systems but for the purposes
of the examination you just want to be able to understand the basic syntax now ordinarily if we
were on a much older machine this command would actually output the particular service such as
maybe network manager and it would also tell you for every single run level if this service is on
or off so you might see zero for run level zero and then the word off of course run level zero
as a shutdown state so that would make sense but we would also have one for run level one that could
also be off and then two and three and four all the way up to six you kind of get the drift maybe
you'll see on number three that the network manager is on perhaps and the output of this command would
show you this information for all of the services on the system so you would be able to determine
from that output oh that service is switched on at run level five for example but switched off at
run level three and with this command what you can also do is modify this setting so let's maybe say
you were on a particular system and the bluetooth service was switched off so pretty much you did
your check config list and you saw for all the run levels bluetooth was off what you then could do
is you could take the command check config bluetooth on and then hit enter now as it transpires this
is not going to work on my modern based system but nevertheless for the purposes of the examination
this would be the syntax you would use and if you wanted to switch it off we could just say
off now if you wanted to control a particular service and for run level three we could switch
that service on now if you wanted to change a particular service turn it on or turn it off
but at a specific run level the check config command would also allow you to do that you could
say something like say check config network manager to take the network manager service
you can say dash dash level three for example and turn it on for level three then if you happen to
confirm this by using your dash dash list command suddenly for the network manager service you would
see for run level three this was on or if you wanted to turn it off you could do a very similar
thing you could just say you know check config for network manager at run level three i want to turn
it off so check config makes this really quite easy to be able to manage these types of services
as opposed to you manually having to go in and rename all of these sim links which is really
quite messy now like i say this would be the solution you would use on a red hat based system
let me just turn off this machine here okay and let me open up my zubuntu machine okay so we go
back to our zubuntu machine if i go into the man page for update hyphen rc.d we can see this is used
to remove and install system v style init script links so if we go down to the example you can see
some of the example syntax we can use and what we can also do is we can actually use the update rc
command to specify which levels to start or stop a particular script so what i could say here for
example i could say updates hyphen rc.d which is the command and then give the name of the service
that may be be something let's say an Apache 2 server and i could start that and then i'll give a
priority value let's just maybe see 10 and then i can specify the run levels where i would want the
Apache 2 service to actually start so i could say at run level 2 3 4 and 5 we would want it to start
and then i can do a dot to separate this out and then say we would want this service to stop at
run level 0 which is shut down also at run level 1 and run level 6 of course because that is the
reboot state and then another dot and suddenly with a lot of granular control we can specify
whether a particular service starts at all these different run levels and when it should be stopped
so again if i decided that you know what i only wanted to run at run level 5 i could start it at
run level 5 and make sure it's stopping at 2 3 4 as well as obviously 0 and 6 now like i say the
big disadvantage here is that these tools are pretty much antiquated and this is the frustrating
part at least in my opinion with its heavy presence in the lpik 2 examination but nevertheless even
though we are almost always using system d based systems in modern linux system administration
we do have to be aware of these legacy tools and these legacy systems so we have the update rc.d
command on debian based systems again this is going to allow you to control what particular
services are starting and stopping at particular run levels and with red hat based systems we can
do a similar thing with the check config command now these two commands ultimately do very very
similar things but as we can see here the syntax is a little bit different so i really would encourage
you to read demand pages in their entirety to help you understand the differences with respect to
the syntax and the options that each command provides okay dox i hope this has been informative
for you and i'd like to thank you for viewing