Skip to content

Click on each book below to review & buy on Amazon.

As an Amazon Associate, I earn from qualifying purchases.


RHCSA - Deploy, Configure, & Maintain Systems: Start & Stop Services & Configure Services to Start Automatically at Boot

A systemd service is a background process or application that is managed by the systemd initialization system. It consists of a configuration file that defines how the service should be started, stopped, and managed, along with the necessary scripts or commands to execute the desired functionality. systemd services enable efficient and consistent management of daemons, allowing for automatic startup, dependency tracking, process supervision, logging, and fine-grained control over system resources and behavior.

Managing Services

You can start, stop and check the status of services by using the systemctl command. You will need to use sudo or run the commands as root when altering the service state, however this is not required when checking the status of a service. The systemctl command is also used to enable the service to start at boot time.

The below table shows the systemctl options in relation to the exam objective:

Command Description
sudo systemctl start <service> Start a service immediately.
sudo systemctl stop <service> Stop a running service.
sudo systemctl restart <service> Restart a running service.
sudo systemctl reload <service> Reload the configuration of a running service.
sudo systemctl enable <service> Enable a service to start on boot.
sudo systemctl disable <service> Disable a service from starting on boot.
systemctl status <service> Show the status and information of a service.

The following exercise will get you practicing managing a service:

It is very important you know how to enable or disable a service for boot time startup. An exam objective could very well be ensuring that a service is in a particular state.

Manage the crond service:

Check the full status of the service, which shows latest log entries for the service and information on whether the service is enabled (start on boot) or active (currently running or not):

systemctl status crond

An example output from this command is below, showing an active running state:

● crond.service - Command Scheduler
    Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; preset: enabled
    Active: active (running) since Fri 2023-08-11 07:53:40 BST; 3min 8s ago
  Main PID: 1348 (crond)
     Tasks: 1 (limit: 48714)
    Memory: 1.1M
       CPU: 206ms
    CGroup: /system.slice/crond.service
           └─1348 /usr/sbin/crond -n

Press the Q key to return to the prompt if required.

Stop the service:

sudo systemctl stop crond

Disable the service:

sudo systemctl disable crond

Check the full status of the service again:

systemctl status crond

Press the Q key to return to the prompt if required.

Perform a check on just the active state:

systemctl is-active crond

Perform a check to see if the service is enabled to start on boot:

systemctl is-enabled crond

Enable the service to start on boot:

sudo systemctl enable crond

Start the service back up:

sudo systemctl start crond

Check the status of the service again to ensure it is running and enabled.

systemctl status crond

Press the Q key to return to the prompt if required.


Support DTV Linux

Click on each book below to review & buy on Amazon. As an Amazon Associate, I earn from qualifying purchases.

NordVPN ®: Elevate your online privacy and security. Grab our Special Offer to safeguard your data on public Wi-Fi and secure your devices. I may earn a commission on purchases made through this link.