How to Manage Systemd Units on Linux Using chkservice

How to Manage Systemd Units on Linux Using chkservice

Systemd has become an integral part of the Linux ecosystem. It serves as the default init system for many distributions. Although managing systemd units can seem intricate, there are tools available to simplify the process significantly. This guide will help you understand how to use the chkservice utility to efficiently manage and oversee your systemd units. By doing this, you can ensure that your Linux system runs seamlessly, without any issues.

What Are the Use Cases of the chkservice Utility?

The command chkservice is a utility designed for managing systemd units on Linux. Here are some use cases for chkservice:

  1. Interactive Systemd Management. chkservice provides a text-based user interface (TUI) that allows users to interactively manage systemd services. This visual approach can be more intuitive than traditional command-line methods for some users.
  2. Comprehensive System Overview. With chkservice, users can get a consolidated view of all systemd services in one place, displaying their statuses (active, inactive, failed, etc.), boot settings (enabled or disabled), and brief descriptions.
  3. Batch Service Operations. Through its interface, users can simultaneously enable, disable, start, or stop multiple services. This batch operation capability eliminates the need for multiple individual systemctl commands, enhancing efficiency.
  4. Quick Troubleshooting. chkservice allows administrators to swiftly identify services that are running, those that have failed, and those set to launch on system boot. This feature becomes indispensable when diagnosing issues related to service failures or boot processes.
  5. Transition Aid for SysV Users. For those familiar with the older SysV init system, chkservice offers a layout reminiscent of the chkconfig tool, helping users transition smoothly to systemd.

The chkservice utility is an invaluable asset for Linux users, regardless of their expertise level, streamlining the management of systemd units. In the following section, we’ll delve into how to manage systemd units on Linux using chkservice.

Process to Manage Systemd Units on Linux Using chkservice

Here’s a guide on how to manage systemd units on Linux using the chkservice utility, complete with descriptions and potential outputs:

#1 Installation

Before using chkservice, you must ensure it’s installed on your system.

For Debian/Ubuntu:

sudo apt install chkservice

For RedHat/CentOS:

sudo yum install chkservice

#2 Launch chkservice

Start the chkservice tool.

sudo chkservice

Output:

A text-based user interface (TUI) will display, listing all the systemd services, their statuses (active, inactive, etc.), and their settings for startup at boot (enabled or disabled).

#3 Navigate and Select Services

Use arrow keys to navigate through the list. The space bar can be used to select or deselect services for batch operations. For the output, highlighted lines will indicate your current position. A marked checkbox or indicator will show selected services.

#4 Manage Services

While in the interface:

  • Press s to toggle the start/stop status of a selected service.
  • Press e to toggle the enable/disable status for startup at boot for a selected service.

Output:

Changes will be visually reflected in the TUI. For example, the service’s status might change from “inactive” to “active“.

#5 Exit chkservice

Once done with your modifications, you can exit the utility. Command (while in the TUI):

q (press the 'q' key)

You’ll return to your standard command line prompt.

Notes

  • Remember, any changes made using chkservice affect the actual systemd services. Always be cautious and aware of the services you’re altering.
  • While chkservice provides a visual way to manage services, it’s still a good practice to double-check any critical changes using the systemctl command.
  • Always ensure you’ve got the necessary backups or recovery procedures in place before making significant changes to critical system services.

You’ve got it! With chkservice, you can now adeptly manage systemd units on Linux. This tool offers users, whether beginners or experts, an effortless method to monitor and control their system services, guaranteeing the stability and efficiency of their Linux systems.

Conclusion

Looking to deploy Linux in the cloud? With Gcore Cloud, you can choose from Basic VM, Virtual Instances, or VPS/VDS suitable for Linux:

Choose an instance

How to Manage Systemd Units on Linux Using chkservice

Subscribe
to our newsletter

Get the latest industry trends, exclusive insights, and Gcore
updates delivered straight to your inbox.