top of page

Oracle Linux Basic Administration Series - Part 6 - How to Manage Services Using systemctl in Oracle Linux

  • Jason Beattie
  • 19 hours ago
  • 2 min read

Modern Oracle Linux systems use systemd as their default system and service manager. The systemctl command is your main tool to control services - starting, stopping, enabling, and checking their status.


In this blog, you’ll learn how to use systemctl effectively to manage services and system states.


Step 1: Understanding systemd and systemctl

systemd is the system and service manager that replaced older init systems. It’s responsible for:


  • Starting services during boot

  • Managing service dependencies

  • Handling background daemons and timers

  • Logging events


systemctl is the command-line utility for interacting with systemd.


Step 2: Checking Service Status

To check whether a service is running:

systemctl status servicename

Example:

sudo systemctl status sshd
ree

Output:

● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled)
   Active: active (running)

Key fields:

  • Loaded: service file exists and is recognized

  • Active: shows whether it’s running

  • Enabled: means it starts automatically on boot



Step 3: Starting and Stopping Services

Start a service:

sudo systemctl start servicename

Stop a service:

sudo systemctl stop servicename

Restart a service:

sudo systemctl restart servicename

Reload service configuration (without stopping it):

sudo systemctl reload servicename

Example:

ree

Step 4: Enabling and Disabling Services at Boot

To start a service automatically at boot:

sudo systemctl enable servicename

To disable auto-start:

sudo systemctl disable servicename

To check if a service is enabled:

systemctl is-enabled servicename

Example:


ree

Step 5: Viewing All Services

List all running services:

systemctl list-units --type=service --state=running
ree

List all (active/inactive):

systemctl list-units --type=service
ree

List all installed services (even inactive):

systemctl list-unit-files --type=service
ree

Step 6: Analyzing Service Logs

You can view logs for a specific service using journalctl:

sudo journalctl -u servicename

Example:


ree

To see only recent entries:

sudo journalctl -u sshd -n 20
ree

To continuously monitor logs (like tail -f):

sudo journalctl -u sshd -f

Step 7: Reloading the systemd Daemon

If you edit a service file manually, reload systemd to apply changes:

sudo systemctl daemon-reload

Then restart the service:

sudo systemctl restart servicename

Step 8: Masking and Unmasking Services

Masking prevents a service from being started manually or automatically.

To mask a service:

sudo systemctl mask servicename

To unmask:

sudo systemctl unmask servicename

Example:

sudo systemctl mask httpd
ree

Step 9: Check System Boot Performance

You can analyze boot time and identify slow services using:

systemd-analyze

ree

To see detailed breakdowns:

systemd-analyze blame

ree



Step 10: Rebooting and Power Management


systemctl can also control the system state.

Task

Command

Reboot the system

sudo systemctl reboot

Power off the system

sudo systemctl poweroff

Suspend

sudo systemctl suspend

Halt

sudo systemctl halt


Conclusion


You now know how to manage services on Oracle Linux using systemctl. This skill helps you control system processes, troubleshoot issues, and ensure your server behaves exactly as you expect.


In the next post, we’ll learn how to monitor system performance and resources, a crucial part of maintaining a healthy Oracle Linux environment.

 
 
 

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
Post: Blog2 Post
  • LinkedIn

©2023 Proudly created with Wix.com

bottom of page