SysVinit Service Management
Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or
Already have an account? Sign In »

Video Transcription
00:00
>> Hey there, Cybrarians.
00:00
Welcome back to the Linux plus course here at Cybrary.
00:00
I'm your instructor Rob Gills.
00:00
In today's lesson, we're going to be
00:00
talking about SysVinit service management.
00:00
Upon completion of this lesson,
00:00
you are going to be able to understand
00:00
the purpose of Sysvinit.
00:00
We're going to talk about how Sysvinit works.
00:00
Then we're also going to
00:00
>> use the service command to work
00:00
>> with and managed services in Sysvinit.
00:00
System V and Sysvinit were the service manager and
00:00
initialization method used prior to system D. System V,
00:00
which is actually system five,
00:00
goes back to Unix,
00:00
and the name comes from the fact that it was
00:00
the fifth release of Unix commercially by AT&T.
00:00
It has been around for a while.
00:00
Now, earlier versions of Linux used
00:00
Sysvinit to manage services
00:00
and system V to manage services.
00:00
System D is backwards compatible with system five.
00:00
However, system five or Sysvinit has
00:00
a much different structure and it
00:00
uses the service command to manage services,
00:00
whereas system D uses the systemctl command.
00:00
The service command operates on scripts
00:00
for each service or daemon,
00:00
however you want to say that,
00:00
and those are located in the /etc/init.d directory.
00:00
Let's go ahead and have a look with some demo time.
00:00
Here we are over in the centos environment and
00:00
let's first go ahead and take a look at this directory.
00:00
Where we are right now is the /etc/init.d directory.
00:00
I'm just going too do an al/al in this directory.
00:00
What we can see is that there are these script files
00:00
for each and every one of these service daemons.
00:00
Let's go ahead and pick on SSHD again here.
00:00
Let's do a sudo less SSHD.
00:00
Then we can see that this is a script file
00:00
that is setup for SSHD,
00:00
and it has information about library functions,
00:00
just config settings where KeyGen is operated,
00:00
where to find RSA, DSA,
00:00
different keys, and then a lot of
00:00
different functions that are specific
00:00
to working with this service.
00:00
When we're talking about working with
00:00
Sysvinit or system five services,
00:00
there's a couple of ways that we can
00:00
manage working with services.
00:00
The first thing we can do is we can
00:00
actually pass commands directly
00:00
into these scripted service files directly.
00:00
For instance, if we wanted to stop SSH on
00:00
the system we could do a sudo /etc/init.d /sshhd.
00:00
Then we tell the command that we
00:00
want to run is the stop command.
00:00
Now, it's going to stop SSHD.
00:00
If we want to get the status,
00:00
we can just say status.
00:00
We're saying Sudo /etc/init.d /sshhd,
00:00
and we're telling it that we want SSHD to print
00:00
it's status for us to standard out.
00:00
There it goes, it shows that it's stopped.
00:00
If we want to go ahead and start it back up again,
00:00
we can just change this to start and we're saying,
00:00
"Hey, /etc/init.d /sshhd service,
00:00
run the start function",
00:00
and it's going to start SSHD.
00:00
Then finally, we can do a restart
00:00
as well and there we are,
00:00
it's restarting SSHD for us.
00:00
But the wonderful thing about working with
00:00
system V is that there is a command called Service.
00:00
Service helps you out
00:00
because it's a wrapper around these scripts.
00:00
You don't want to actually have to run
00:00
the entire path to each one of these files.
00:00
As long as there is a service wrapper around it,
00:00
you can use that command,
00:00
and in this case with SSHD there is.
00:00
Let me clear the screen and
00:00
we'll do the same things we did again,
00:00
but now we'll just run the service command instead.
00:00
We could use sudo service, SSHD,
00:00
stop, and that will stop the SSHD service.
00:00
If we want to go ahead and get the status
00:00
now we can just change this to status,
00:00
so service SSHD status.
00:00
We can see that it says that daemon has stopped.
00:00
To go ahead and restart this,
00:00
we can just run service sshd start.
00:00
Then to restart it, we can just type in
00:00
restart and there we go has been restarted.
00:00
But notice that the service command syntax
00:00
is a little bit different than systemctl commands.
00:00
Recall that when we did systemctl,
00:00
we did systemctl restart sshhd.
00:00
When you're working with service,
00:00
your service, the name of the service,
00:00
and what you want to do to it.
00:00
It's just a little bit
00:00
backwards when you're talking about
00:00
system V versus systemctl
00:00
and you're working with the two of those.
00:00
But with that, we've reached the end of this lesson.
00:00
In this lesson we covered the purpose of
00:00
Sysvinit and how Sysvinit and system five,
00:00
work with services or daemons.
00:00
Also, we covered how to use
00:00
the service and service commands to operate services in
00:00
system V. Thanks so much for being
00:00
here and I look forward to seeing
00:00
you at our next lesson.
Up Next
Instructed By
Similar Content