3.7.6 Displaying the Status of Services

You can use the is-active subcommand to check whether a service is running (active) or not running (inactive):

# systemctl is-active httpd
# systemctl is-active nfs

You can use the status action to view a detailed summary of the status of a service, including a tree of all the tasks in the control group (cgroup) that the service implements:

# systemctl status httpd
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
   Active: active (running) since Mon 2014-04-28 15:02:40 BST; 1s ago
 Main PID: 6452 (httpd)
   Status: "Processing requests..."
   CGroup: /system.slice/httpd.service
           ├─6452 /usr/sbin/httpd -DFOREGROUND
           ├─6453 /usr/sbin/httpd -DFOREGROUND
           ├─6454 /usr/sbin/httpd -DFOREGROUND
           ├─6455 /usr/sbin/httpd -DFOREGROUND
           ├─6456 /usr/sbin/httpd -DFOREGROUND
           └─6457 /usr/sbin/httpd -DFOREGROUND

Apr 28 15:02:40 localhost.localdomain systemd[1]: Started The Apache HTTP Ser...
Hint: Some lines were ellipsized, use -l to show in full.

A cgroup is a collection of processes that are bound together so that you can control their access to system resources. In the example, the cgroup for the httpd service is httpd.service, which is in the system slice.

Slices divide the cgroups on a system into different categories. To display the slice and cgroup hierarchy, use the systemd-cgls command:

# systemd-cgls
│ ├─user-1000.slice
│ │ └─session-12.scope
│ │   ├─3152 gdm-session-worker [pam/gdm-password]
│ │   ├─3169 /usr/bin/gnome-keyring-daemon --daemonize --login
│ │   ├─3171 gnome-session --session gnome-classic
│ │   │ ...
│ │   └─3763 /usr/libexec/evolution-calendar-factory
│ └─user-0.slice
│   ├─session-13.scope
│   │ ├─3810 sshd: root@pts/0    
│   │ ├─3836 -bash
│   │ ├─4015 systemd-cgls
│   │ └─4016 systemd-cgls
│   └─session-6.scope
│     └─3030 /usr/sbin/anacron -s
  ├─1 /usr/lib/systemd/systemd --switched-root --system --deserialize 23
  │ └─3421 /usr/sbin/bluetoothd -n
  │ └─3420 /usr/lib/udisks2/udisksd --no-debug
  │ └─2812 /usr/libexec/colord
  │ └─2760 /usr/libexec/upowerd
  │ ├─1288 /usr/sbin/iscsid
  │ └─1289 /usr/sbin/iscsid
  │ ...
  │ └─427 /bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --sy
  │ └─391 /usr/bin/python /usr/sbin/firewalld --nofork --nopid
  │ └─524 /sbin/iprdump --daemon
  │ └─466 /sbin/iprinit --daemon
  │ └─467 /sbin/iprupdate --daemon
    └─736 /sbin/dhclient -H localhost -1 -q -lf /var/lib/dhclient/dhclient-f174a

system.slice contains services and other system processes. user.slice contains user processes, which run within transient cgroups called scopes. In the example, the processes for the user with ID 1000 are running in the scope session-12.scope under the slice /user.slice/user-1000.slice.

You can use the systemctl command to limit the CPU, I/O, memory, and other resources that are available to the processes in service and scope cgroups. See Section 3.7.7, “Controlling Access to System Resources”.

For more information, see the systemctl(1) and systemd-cgls(1) manual pages.