1
00:00:00,000 --> 00:00:17,719
Hey guys and welcome back. So in the previous nuggets we had talked about how we could modify

2
00:00:17,719 --> 00:00:24,960
our run levels. We could use the command init as well as tell init which would be the preferred

3
00:00:24,960 --> 00:00:31,480
method and as opposed to being able to change our particular run level we could also modify what

4
00:00:31,480 --> 00:00:37,679
particular services were starting or stopped during a particular run level. Now the way we

5
00:00:37,679 --> 00:00:45,840
actually saw this was by renaming simlinks. So we would ultimately move a particular simlink to

6
00:00:45,840 --> 00:00:51,600
rename it and if it started with an s we could change it to begin with a k and ultimately modify

7
00:00:51,600 --> 00:00:57,800
the behavior. Now this is not the most practical way to do such a thing and we do have different

8
00:00:57,800 --> 00:01:04,439
commands that we can use to ultimately modify and determine when services are started or stopped.

9
00:01:04,439 --> 00:01:11,799
Now we have two commands the first one is called check config or chk config. This command is going

10
00:01:11,799 --> 00:01:18,000
to be based on red hat based systems so on your Ubuntu machine this command is not going to be

11
00:01:18,000 --> 00:01:25,040
present instead if you're using a debian based machines such as ubuntu or ubuntu the command

12
00:01:25,040 --> 00:01:31,120
we're going to use instead will be update in fact let me just write that a little bit clearer hyphen

13
00:01:31,120 --> 00:01:39,120
rc.d now this actually looks like a directory but no indeed this is actually the command you would

14
00:01:39,120 --> 00:01:46,799
use on a debian based system so right now I want to demonstrate the check config command and as we

15
00:01:46,799 --> 00:01:51,759
know this is not available on a debian based system so what I've actually done in the meantime is

16
00:01:51,759 --> 00:01:58,479
I've actually booted up a rocky linux distribution which I have on my computer now rocky linux happens

17
00:01:58,479 --> 00:02:05,120
to come from red hat so because it is red hat based we're going to have the check config command so

18
00:02:05,120 --> 00:02:11,360
if I go into the man page for check config we can see this utility updates in queries run level

19
00:02:11,360 --> 00:02:16,479
information for system services now we have all of these different options we can go through

20
00:02:16,639 --> 00:02:21,679
but one thing I will say is that when we try to use this command such as check config dash

21
00:02:21,679 --> 00:02:27,759
dash list in fact I would help if I could type this correctly so check config notice we have

22
00:02:27,759 --> 00:02:33,280
some crucial information it says here the sysv configuration data might be overridden by the

23
00:02:33,280 --> 00:02:39,039
native system d pretty much what I'm saying is that whilst this command is actually available here

24
00:02:39,039 --> 00:02:44,719
we have a man page for it because we are now using modern system d we're actually not really getting

25
00:02:44,719 --> 00:02:51,039
the outputs from the check config dash dash list option which is a little bit unfortunate like I say

26
00:02:51,039 --> 00:02:56,319
this is a bit of a problem when we're dealing with such old legacy based systems but for the purposes

27
00:02:56,319 --> 00:03:02,000
of the examination you just want to be able to understand the basic syntax now ordinarily if we

28
00:03:02,000 --> 00:03:08,240
were on a much older machine this command would actually output the particular service such as

29
00:03:08,240 --> 00:03:16,000
maybe network manager and it would also tell you for every single run level if this service is on

30
00:03:16,000 --> 00:03:23,120
or off so you might see zero for run level zero and then the word off of course run level zero

31
00:03:23,120 --> 00:03:28,640
as a shutdown state so that would make sense but we would also have one for run level one that could

32
00:03:28,640 --> 00:03:33,840
also be off and then two and three and four all the way up to six you kind of get the drift maybe

33
00:03:33,840 --> 00:03:39,840
you'll see on number three that the network manager is on perhaps and the output of this command would

34
00:03:39,840 --> 00:03:45,680
show you this information for all of the services on the system so you would be able to determine

35
00:03:45,680 --> 00:03:52,159
from that output oh that service is switched on at run level five for example but switched off at

36
00:03:52,159 --> 00:04:00,080
run level three and with this command what you can also do is modify this setting so let's maybe say

37
00:04:00,080 --> 00:04:06,560
you were on a particular system and the bluetooth service was switched off so pretty much you did

38
00:04:06,560 --> 00:04:12,560
your check config list and you saw for all the run levels bluetooth was off what you then could do

39
00:04:12,560 --> 00:04:19,439
is you could take the command check config bluetooth on and then hit enter now as it transpires this

40
00:04:19,439 --> 00:04:25,280
is not going to work on my modern based system but nevertheless for the purposes of the examination

41
00:04:25,279 --> 00:04:29,359
this would be the syntax you would use and if you wanted to switch it off we could just say

42
00:04:29,359 --> 00:04:35,839
off now if you wanted to control a particular service and for run level three we could switch

43
00:04:35,839 --> 00:04:41,439
that service on now if you wanted to change a particular service turn it on or turn it off

44
00:04:41,439 --> 00:04:46,319
but at a specific run level the check config command would also allow you to do that you could

45
00:04:46,319 --> 00:04:52,000
say something like say check config network manager to take the network manager service

46
00:04:52,000 --> 00:04:58,560
you can say dash dash level three for example and turn it on for level three then if you happen to

47
00:04:58,560 --> 00:05:04,800
confirm this by using your dash dash list command suddenly for the network manager service you would

48
00:05:04,800 --> 00:05:10,560
see for run level three this was on or if you wanted to turn it off you could do a very similar

49
00:05:10,560 --> 00:05:17,360
thing you could just say you know check config for network manager at run level three i want to turn

50
00:05:17,360 --> 00:05:23,920
it off so check config makes this really quite easy to be able to manage these types of services

51
00:05:23,920 --> 00:05:28,960
as opposed to you manually having to go in and rename all of these sim links which is really

52
00:05:28,960 --> 00:05:34,160
quite messy now like i say this would be the solution you would use on a red hat based system

53
00:05:34,160 --> 00:05:40,240
let me just turn off this machine here okay and let me open up my zubuntu machine okay so we go

54
00:05:40,240 --> 00:05:47,840
back to our zubuntu machine if i go into the man page for update hyphen rc.d we can see this is used

55
00:05:47,840 --> 00:05:54,319
to remove and install system v style init script links so if we go down to the example you can see

56
00:05:54,319 --> 00:06:01,519
some of the example syntax we can use and what we can also do is we can actually use the update rc

57
00:06:01,519 --> 00:06:07,680
command to specify which levels to start or stop a particular script so what i could say here for

58
00:06:07,759 --> 00:06:14,560
example i could say updates hyphen rc.d which is the command and then give the name of the service

59
00:06:14,560 --> 00:06:19,759
that may be be something let's say an Apache 2 server and i could start that and then i'll give a

60
00:06:19,759 --> 00:06:25,519
priority value let's just maybe see 10 and then i can specify the run levels where i would want the

61
00:06:25,519 --> 00:06:33,680
Apache 2 service to actually start so i could say at run level 2 3 4 and 5 we would want it to start

62
00:06:33,680 --> 00:06:39,199
and then i can do a dot to separate this out and then say we would want this service to stop at

63
00:06:39,199 --> 00:06:46,079
run level 0 which is shut down also at run level 1 and run level 6 of course because that is the

64
00:06:46,079 --> 00:06:51,920
reboot state and then another dot and suddenly with a lot of granular control we can specify

65
00:06:51,920 --> 00:06:57,439
whether a particular service starts at all these different run levels and when it should be stopped

66
00:06:57,439 --> 00:07:04,000
so again if i decided that you know what i only wanted to run at run level 5 i could start it at

67
00:07:04,000 --> 00:07:12,000
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

68
00:07:12,000 --> 00:07:17,120
big disadvantage here is that these tools are pretty much antiquated and this is the frustrating

69
00:07:17,120 --> 00:07:23,920
part at least in my opinion with its heavy presence in the lpik 2 examination but nevertheless even

70
00:07:23,920 --> 00:07:29,840
though we are almost always using system d based systems in modern linux system administration

71
00:07:29,840 --> 00:07:36,080
we do have to be aware of these legacy tools and these legacy systems so we have the update rc.d

72
00:07:36,080 --> 00:07:42,000
command on debian based systems again this is going to allow you to control what particular

73
00:07:42,000 --> 00:07:48,240
services are starting and stopping at particular run levels and with red hat based systems we can

74
00:07:48,240 --> 00:07:54,000
do a similar thing with the check config command now these two commands ultimately do very very

75
00:07:54,000 --> 00:07:59,199
similar things but as we can see here the syntax is a little bit different so i really would encourage

76
00:07:59,199 --> 00:08:05,120
you to read demand pages in their entirety to help you understand the differences with respect to

77
00:08:05,120 --> 00:08:10,800
the syntax and the options that each command provides okay dox i hope this has been informative

78
00:08:10,800 --> 00:08:14,800
for you and i'd like to thank you for viewing

