Hey guys and welcome back. So in the previous nugget we had talked about sysv init and we
also mentioned the concept of run levels. Now what I want to talk about is a very particular
file and this is called the init tab file and the location of this file is something
you want to be remembering and this is going to be located in the etsy directory. So etsy
init tab this is where we want to go. Now in order for a system to know which run level
it should be running at so to speak the actual init process remember that one we talked about
the very first process process number one init is going to check in this file like I
say within etsy init tab and it's going to read the contents of this file and infer
what indeed the run level should be. So what I'm going to do is to briefly show you what
this file actually looks like and then we'll talk about what the contents actually mean.
Now here is the thing with respect to sysv init this is actually an older style of managing
your system in more modern systems we have something called system d but for the purposes
of the examination we have to know sysv init but what I'm trying to say here is is that
it happens to be antiquated and I do not actually have this configuration file on my distribution
right here. If I happen to go into my etsy directory and I do an ls you will see that
on this newer system this file doesn't actually exist if I grit for init we can see init init
dot d but we cannot see init tab so what I'm going to do is to try to find an online example
for you to view and then we'll talk about what the contents actually mean then shall
we so let me go and find an example. Okay so this is an example of what an init tab
file would have looked like. Okay so let's focus in on this part right here now this
is actually subdivided into four different sections these are separated by colons so
at the very left hand side here we can see lo l1 in fact let me just make my pen a little
bit narrower so this is the first value here on the very left hand side this value is known
as the id now the id is just a way for you to refer to a line it doesn't actually have
any type of effect we just want this to be a unique value okay so that is the first value
then we have our colon and then we go to our next value value number two so in this case
we see zero one two three four five and six these actually correlate to the run levels
what we're talking about and now the third column here see the word wait for every single
one but it doesn't have to be this value this is known as the keyword column and there actually
are some additional keywords here it's not just wait all the time and we'll get to talk
about the different ones we can get this really just tells the init process how this particular
line is supposed to be handled so right now as we can see here the example just says wait for
all entries we'll get to see what that means and the alternative values in a minute and the last
value here at the very end all these ones this is ultimately the command it's basically the
command that the init process should run when this line happens to be selected so one of the
things that we have to focus in on are these different values that we can have for the action in
this case here we just see wait what are the values we have available to us but let's actually
talk about it so the very first value I want to talk to you about is the init default value and
this is all one word init default now all this does it ultimately specifies the default run
level for the system so if you specify a init default like I say that will be the default
run value so let's maybe say we have an id value here so we have our id column we have our run
level column and our action column if I happen to maybe give the id I don't know l2 whatever it
may be and then the run level of 3 and then I specified the action was the keyword init
default here when the init process goes to read this particular file it's going to see the init
default action keyword associated with run level 3 and the default run level whenever the system
boots it's going to run at run level 3 okay so init default very very important the next value
we have is sys init and what this means is that any commands that we happen to specify after
the sys init keywords those commands are going to be executed as soon as the system boots so it
doesn't matter what run level we happen to go into these commands are going to be executed
straight away before anything else now the next one is one we happen to see quite a bit in our
example that happens to be the wait action what this is going to instruct init to do is
going to tell init to simply wait and it's going to wait for the commands that have been specified
after this keyword to fully complete now some of these commands are going to be scripts that
maybe take I don't know 10 seconds when we have this wait keyword we are ultimately ensuring the
init process is going to allow these scripts to fully complete before any other commands are
executed this is really all about system stability to make sure the startup happens in a correct or
orderly fashion now another value happens to be control alt del you may be familiar with this
combination now what this action does it's designed to trap the keyboard combination that we use when
we type control alt delete the reality is is that pressing this combination can result in some type
of file system corruption and instead we want to invoke a more graceful shutdown so really we want
to trap these keys and replace it with the shutdown command or something like I say which would
result in a more stable and graceful shutdown you do not want to be causing any type of system
outage due to file system corruption now the other action we have is the power fail action now what
this is actually sent from it's sent from the ups no not the mail service it is the uninterruptible
power supply and this is sent from the ups when the ups is about to run out of power so if you
happen to receive this power fail signal it means that the power supply is coming dangerously close
to emptying so you want to shut down your operating system to prevent some type of instability if the
power cuts and the system just crashes we have two more to get to the next one is power ok wait and
again this is all one word power ok wait this again relates back to our uninterruptible power
supply or ups so let's say that the ups happens to send that power fail signal we just talked about
however let's then say the ups begins to receive power once again so power has been returned the
way we can signal this that everything is indeed ok is by sending this power ok wait action so when
this power resumes this signal itself here is going to be sent to the init process so when we are
starting up and it is fully aware of what is actually happening now the last one is the respawn
action now this might sound like something out of a video game maybe halo or something now this relates
to a command called mingetty and what this actually does it allows for command line logins ok so if a
user happens to log off the process has to restart so that another user can log on again it tells the
init process to start the mingetty operation at run levels 2 3 4 and 5 so that users can indeed
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
for rebooting whereas run level 1 that is only going to allow access to the root user so this idea
of being able to log out and have to present again another login for another user to go on this
doesn't actually make sense in the context of run level 1 hence why the respawn action is only
available at run levels 2 3 4 and 5 so like I say if we happen to see things like the id and the
run level maybe say run level 5 and init default we know straight away that the default run level is
going to be run level 5 whereas if we see something like say an id and then the sys init action in
fact let me just spell this correctly and then maybe we get a value such as xa forward slash rc.d
which is the rc.d directory we'll talk about that very very shortly and then rc.sys init and I'm
running out of space that apologies what this ultimately is right here this is some setup
scripts and because we are using the sys init action the commands set out and this setup script
will be executed when the system boots regardless of any type of run level so really we can have a
whole bunch of different combinations with respect to what we see within the init tab file but
ultimately the init tab file is all about being able to set up our system in a secure and reliable
way so that if scripts have to run at a particular time they are able to run at a particular time
and be free to complete whilst we could take other actions such as preventing control alt deletes from
inadvertently destabilizing and corrupting our file system as well as controlling things like the
default run level that we want to initially boot into all of this and more can be controlled
directly from the init tab file which is like I say what the init process initially consults now
we happen to mention this concept of scripts the idea that when we boot up we want to run some
particular setup scripts which are going to execute particular commands and run particular
processes what exactly are those scripts well to help us make sense of what we have just saw
right here we're going to be talking about this in the very next nuggets I hope this has been
informative for you I'd like to thank you for viewing