Do not use the service utility
/etc/rc.d/init.d/
directory, it is advised that you use the systemctl utility.
systemctl
command in the following form:
systemctl
status
service_name.service
systemctl
command in the following form instead:
systemctl
is-active
service_name.service
Example 6.3. Checking the status of the httpd service
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
active
~]$ 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
systemctl list-units --type=service
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 6.4. Listing all active services
~]$ 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]
abrtd
service is loaded, active, and running, and it does not have any pending jobs.