Monday, November 16, 2015

Manage Services on RHEL 7 or CentOS 7

Overview

The purpose of this guide is to manage services on RHEL 7 or CentOS 7. Systemctl command is utilized to manage services that are installed. In this guide we have considered Apache2 (httpd) service to be managed.

Applies To

RHEL 7, CentOS 7

Pre-requisites

None

Service Management Table

Service Management Action
Purpose
start
Start a service
stop
Stop a service
restart
Restart a service
enable
Enable service to start at boot time
disable
Disable service to start at boot time, can be started manually once the system is online
status
Check the current status of service
mask
Prevent a service from starting dynamically or even manually until the specific service is unmasked.
Mask will link service to /dev/null, making it impossible to start them. It’s a stronger version of disable, since it prohibits all kinds of activation.
unmask
Revoke masked service (undo already masked service)
is-enabled
Check whether a service is already enabled state or not
is-active
Check whether a service is active (running)
is-failed
Check whether a service has failed (not running)

Service Management Command Line

Start Service

To start the service that’s is stopped or disabled to start at boot time, run the command;

systemctl start httpd

Stop Service

To stop the service that’s is already running, run the command;

systemctl stop httpd

Restart Service

To stop and start the service specified, run the command;

systemctl restart httpd

Enable Service

In order to start the service so that the service starts at boot time enable service, run the command;

systemctl enable httpd

Disable Service

In order to disable the service so that service doesn’t start at boot time disable service, run the command;

systemctl disable httpd

Mask Service

To prohibit / restrict a service to be started manually or dynamically, run the command;

systemctl mask httpd

Unmask Service

To revoke mask of a service, run the command;

systemctl unmask httpd

Service Status

To check the status of a service, run the command;

systemctl status httpd

Service is-enable

To check the if the service is enabled or not, run the command;

systemctl is-enabled httpd

Service is-active

To check the if the service is active or not, run the command;

systemctl is-active httpd

Service is-failed

To check the if the service is failed state, run the command;

systemctl is-failed httpd

SlideShare Information

Guide to manage daemon;s with screenshots is uploaded.

No comments:

Post a Comment