Product SiteDocumentation Site

7.2. Running Services

The systemctl utility also allows you to determine the status of a particular service, as well as to start, stop, or restart a service.

Do not use the service utility

Although it is still possible to use the service utility to manage services that have init scripts installed in the /etc/rc.d/init.d/ directory, it is advised that you use the systemctl utility.

7.2.1. Checking the Service Status

To determine the status of a particular service, use the systemctl command in the following form:
systemctl status service_name.service
This command provides detailed information on the service's status. However, if you merely need to verify that a service is running, you can use the systemctl command in the following form instead:
systemctl is-active service_name.service
Example 7.3. Checking the status of the httpd service
Example 7.1, “Enabling the httpd service” illustrated how to enable starting the httpd service at boot time. Imagine that the system has been restarted and you need to verify that the service is really running. You can do so by typing the following at a shell prompt:
~]$ systemctl is-active httpd.service
You can also display detailed information about the service by running the following command:
~]$ systemctl status httpd.service
httpd.service - LSB: start and stop Apache HTTP Server
          Loaded: loaded (/etc/rc.d/init.d/httpd)
          Active: active (running) since Mon, 23 May 2011 21:38:57 +0200; 27s ago
         Process: 2997 ExecStart=/etc/rc.d/init.d/httpd start (code=exited, status=0/SUCCESS)
        Main PID: 3002 (httpd)
          CGroup: name=systemd:/system/httpd.service
                  ├ 3002 /usr/sbin/httpd
                  ├ 3004 /usr/sbin/httpd
                  ├ 3005 /usr/sbin/httpd
                  ├ 3006 /usr/sbin/httpd
                  ├ 3007 /usr/sbin/httpd
                  ├ 3008 /usr/sbin/httpd
                  ├ 3009 /usr/sbin/httpd
                  ├ 3010 /usr/sbin/httpd
                  └ 3011 /usr/sbin/httpd

To display a list of all active system services, use the following command:
systemctl list-units --type=service
This command provides a tabular output with each line consisting of the following columns:
  • UNIT — A systemd unit name. In this case, a service name.
  • LOAD — Information whether the systemd unit was properly loaded.
  • ACTIVE — A high-level unit activation state.
  • SUB — A low-level unit activation state.
  • JOB — A pending job for the unit.
  • DESCRIPTION — A brief description of the unit.
Example 7.4. Listing all active services
You can list all active services by using the following command:
~]$ systemctl list-units --type=service
UNIT                      LOAD   ACTIVE SUB     JOB DESCRIPTION
abrt-ccpp.service         loaded active exited      LSB: Installs coredump handler which saves segfault data
abrt-oops.service         loaded active running     LSB: Watches system log for oops messages, creates ABRT dump directories for each oops
abrtd.service             loaded active running     ABRT Automated Bug Reporting Tool
accounts-daemon.service   loaded active running     Accounts Service
atd.service               loaded active running     Job spooling tools
[output truncated]
In the example above, the abrtd service is loaded, active, and running, and it does not have any pending jobs.