1
00:00:00,000 --> 00:00:18,440
Hey guys and welcome back. So in the previous nugget we had talked about sysv init and we

2
00:00:18,440 --> 00:00:25,359
also mentioned the concept of run levels. Now what I want to talk about is a very particular

3
00:00:25,359 --> 00:00:32,200
file and this is called the init tab file and the location of this file is something

4
00:00:32,200 --> 00:00:38,119
you want to be remembering and this is going to be located in the etsy directory. So etsy

5
00:00:38,119 --> 00:00:45,399
init tab this is where we want to go. Now in order for a system to know which run level

6
00:00:45,399 --> 00:00:51,200
it should be running at so to speak the actual init process remember that one we talked about

7
00:00:51,200 --> 00:00:57,720
the very first process process number one init is going to check in this file like I

8
00:00:57,720 --> 00:01:04,040
say within etsy init tab and it's going to read the contents of this file and infer

9
00:01:04,040 --> 00:01:09,560
what indeed the run level should be. So what I'm going to do is to briefly show you what

10
00:01:09,560 --> 00:01:14,439
this file actually looks like and then we'll talk about what the contents actually mean.

11
00:01:14,439 --> 00:01:21,159
Now here is the thing with respect to sysv init this is actually an older style of managing

12
00:01:21,159 --> 00:01:27,039
your system in more modern systems we have something called system d but for the purposes

13
00:01:27,039 --> 00:01:32,039
of the examination we have to know sysv init but what I'm trying to say here is is that

14
00:01:32,039 --> 00:01:38,519
it happens to be antiquated and I do not actually have this configuration file on my distribution

15
00:01:38,519 --> 00:01:44,479
right here. If I happen to go into my etsy directory and I do an ls you will see that

16
00:01:44,479 --> 00:01:50,400
on this newer system this file doesn't actually exist if I grit for init we can see init init

17
00:01:50,400 --> 00:01:56,719
dot d but we cannot see init tab so what I'm going to do is to try to find an online example

18
00:01:56,719 --> 00:02:01,600
for you to view and then we'll talk about what the contents actually mean then shall

19
00:02:01,600 --> 00:02:07,719
we so let me go and find an example. Okay so this is an example of what an init tab

20
00:02:07,719 --> 00:02:12,800
file would have looked like. Okay so let's focus in on this part right here now this

21
00:02:12,800 --> 00:02:19,000
is actually subdivided into four different sections these are separated by colons so

22
00:02:19,000 --> 00:02:24,719
at the very left hand side here we can see lo l1 in fact let me just make my pen a little

23
00:02:24,719 --> 00:02:30,520
bit narrower so this is the first value here on the very left hand side this value is known

24
00:02:30,520 --> 00:02:37,639
as the id now the id is just a way for you to refer to a line it doesn't actually have

25
00:02:37,639 --> 00:02:44,800
any type of effect we just want this to be a unique value okay so that is the first value

26
00:02:44,920 --> 00:02:49,120
then we have our colon and then we go to our next value value number two so in this case

27
00:02:49,120 --> 00:02:56,880
we see zero one two three four five and six these actually correlate to the run levels

28
00:02:56,880 --> 00:03:02,920
what we're talking about and now the third column here see the word wait for every single

29
00:03:02,920 --> 00:03:09,320
one but it doesn't have to be this value this is known as the keyword column and there actually

30
00:03:09,320 --> 00:03:13,840
are some additional keywords here it's not just wait all the time and we'll get to talk

31
00:03:13,879 --> 00:03:20,439
about the different ones we can get this really just tells the init process how this particular

32
00:03:20,439 --> 00:03:25,960
line is supposed to be handled so right now as we can see here the example just says wait for

33
00:03:25,960 --> 00:03:31,759
all entries we'll get to see what that means and the alternative values in a minute and the last

34
00:03:31,759 --> 00:03:37,759
value here at the very end all these ones this is ultimately the command it's basically the

35
00:03:37,759 --> 00:03:44,399
command that the init process should run when this line happens to be selected so one of the

36
00:03:44,399 --> 00:03:50,399
things that we have to focus in on are these different values that we can have for the action in

37
00:03:50,399 --> 00:03:55,479
this case here we just see wait what are the values we have available to us but let's actually

38
00:03:55,479 --> 00:04:01,919
talk about it so the very first value I want to talk to you about is the init default value and

39
00:04:02,079 --> 00:04:09,000
this is all one word init default now all this does it ultimately specifies the default run

40
00:04:09,000 --> 00:04:14,759
level for the system so if you specify a init default like I say that will be the default

41
00:04:14,759 --> 00:04:20,639
run value so let's maybe say we have an id value here so we have our id column we have our run

42
00:04:20,639 --> 00:04:27,399
level column and our action column if I happen to maybe give the id I don't know l2 whatever it

43
00:04:27,399 --> 00:04:34,399
may be and then the run level of 3 and then I specified the action was the keyword init

44
00:04:34,399 --> 00:04:40,879
default here when the init process goes to read this particular file it's going to see the init

45
00:04:40,879 --> 00:04:48,279
default action keyword associated with run level 3 and the default run level whenever the system

46
00:04:48,279 --> 00:04:55,679
boots it's going to run at run level 3 okay so init default very very important the next value

47
00:04:55,759 --> 00:05:02,480
we have is sys init and what this means is that any commands that we happen to specify after

48
00:05:02,480 --> 00:05:08,319
the sys init keywords those commands are going to be executed as soon as the system boots so it

49
00:05:08,319 --> 00:05:13,759
doesn't matter what run level we happen to go into these commands are going to be executed

50
00:05:13,759 --> 00:05:19,160
straight away before anything else now the next one is one we happen to see quite a bit in our

51
00:05:19,160 --> 00:05:25,519
example that happens to be the wait action what this is going to instruct init to do is

52
00:05:25,519 --> 00:05:31,240
going to tell init to simply wait and it's going to wait for the commands that have been specified

53
00:05:31,240 --> 00:05:36,039
after this keyword to fully complete now some of these commands are going to be scripts that

54
00:05:36,039 --> 00:05:42,839
maybe take I don't know 10 seconds when we have this wait keyword we are ultimately ensuring the

55
00:05:42,839 --> 00:05:48,519
init process is going to allow these scripts to fully complete before any other commands are

56
00:05:48,519 --> 00:05:55,359
executed this is really all about system stability to make sure the startup happens in a correct or

57
00:05:55,360 --> 00:06:02,280
orderly fashion now another value happens to be control alt del you may be familiar with this

58
00:06:02,280 --> 00:06:07,879
combination now what this action does it's designed to trap the keyboard combination that we use when

59
00:06:07,879 --> 00:06:13,920
we type control alt delete the reality is is that pressing this combination can result in some type

60
00:06:13,920 --> 00:06:20,040
of file system corruption and instead we want to invoke a more graceful shutdown so really we want

61
00:06:20,040 --> 00:06:25,879
to trap these keys and replace it with the shutdown command or something like I say which would

62
00:06:25,879 --> 00:06:31,840
result in a more stable and graceful shutdown you do not want to be causing any type of system

63
00:06:31,840 --> 00:06:38,879
outage due to file system corruption now the other action we have is the power fail action now what

64
00:06:38,879 --> 00:06:45,439
this is actually sent from it's sent from the ups no not the mail service it is the uninterruptible

65
00:06:45,480 --> 00:06:52,040
power supply and this is sent from the ups when the ups is about to run out of power so if you

66
00:06:52,040 --> 00:06:59,319
happen to receive this power fail signal it means that the power supply is coming dangerously close

67
00:06:59,319 --> 00:07:05,240
to emptying so you want to shut down your operating system to prevent some type of instability if the

68
00:07:05,240 --> 00:07:13,199
power cuts and the system just crashes we have two more to get to the next one is power ok wait and

69
00:07:13,199 --> 00:07:20,240
again this is all one word power ok wait this again relates back to our uninterruptible power

70
00:07:20,240 --> 00:07:27,399
supply or ups so let's say that the ups happens to send that power fail signal we just talked about

71
00:07:27,399 --> 00:07:35,759
however let's then say the ups begins to receive power once again so power has been returned the

72
00:07:35,759 --> 00:07:42,919
way we can signal this that everything is indeed ok is by sending this power ok wait action so when

73
00:07:43,120 --> 00:07:49,879
this power resumes this signal itself here is going to be sent to the init process so when we are

74
00:07:49,879 --> 00:07:55,879
starting up and it is fully aware of what is actually happening now the last one is the respawn

75
00:07:55,879 --> 00:08:01,439
action now this might sound like something out of a video game maybe halo or something now this relates

76
00:08:01,439 --> 00:08:10,560
to a command called mingetty and what this actually does it allows for command line logins ok so if a

77
00:08:10,600 --> 00:08:18,680
user happens to log off the process has to restart so that another user can log on again it tells the

78
00:08:18,680 --> 00:08:28,439
init process to start the mingetty operation at run levels 2 3 4 and 5 so that users can indeed

79
00:08:28,439 --> 00:08:36,480
log in now like I say run level 0 is a shutdown so we don't need to log in run level 6 is also

80
00:08:36,720 --> 00:08:44,639
for rebooting whereas run level 1 that is only going to allow access to the root user so this idea

81
00:08:44,639 --> 00:08:51,440
of being able to log out and have to present again another login for another user to go on this

82
00:08:51,440 --> 00:08:57,680
doesn't actually make sense in the context of run level 1 hence why the respawn action is only

83
00:08:57,680 --> 00:09:04,000
available at run levels 2 3 4 and 5 so like I say if we happen to see things like the id and the

84
00:09:04,000 --> 00:09:09,879
run level maybe say run level 5 and init default we know straight away that the default run level is

85
00:09:09,879 --> 00:09:17,639
going to be run level 5 whereas if we see something like say an id and then the sys init action in

86
00:09:17,639 --> 00:09:25,120
fact let me just spell this correctly and then maybe we get a value such as xa forward slash rc.d

87
00:09:25,120 --> 00:09:32,559
which is the rc.d directory we'll talk about that very very shortly and then rc.sys init and I'm

88
00:09:32,559 --> 00:09:38,159
running out of space that apologies what this ultimately is right here this is some setup

89
00:09:38,159 --> 00:09:45,399
scripts and because we are using the sys init action the commands set out and this setup script

90
00:09:45,399 --> 00:09:51,879
will be executed when the system boots regardless of any type of run level so really we can have a

91
00:09:51,879 --> 00:09:57,959
whole bunch of different combinations with respect to what we see within the init tab file but

92
00:09:57,960 --> 00:10:04,200
ultimately the init tab file is all about being able to set up our system in a secure and reliable

93
00:10:04,200 --> 00:10:10,680
way so that if scripts have to run at a particular time they are able to run at a particular time

94
00:10:10,680 --> 00:10:17,080
and be free to complete whilst we could take other actions such as preventing control alt deletes from

95
00:10:17,080 --> 00:10:23,519
inadvertently destabilizing and corrupting our file system as well as controlling things like the

96
00:10:23,519 --> 00:10:29,079
default run level that we want to initially boot into all of this and more can be controlled

97
00:10:29,079 --> 00:10:35,279
directly from the init tab file which is like I say what the init process initially consults now

98
00:10:35,279 --> 00:10:41,399
we happen to mention this concept of scripts the idea that when we boot up we want to run some

99
00:10:41,399 --> 00:10:46,279
particular setup scripts which are going to execute particular commands and run particular

100
00:10:46,279 --> 00:10:51,679
processes what exactly are those scripts well to help us make sense of what we have just saw

101
00:10:51,839 --> 00:10:56,239
right here we're going to be talking about this in the very next nuggets I hope this has been

102
00:10:56,239 --> 00:11:00,639
informative for you I'd like to thank you for viewing

