Product SiteDocumentation Site

F.9. Administering services with systemd

The move to systemd also brought new administration utilities to Fedora. Administrators have the ability to start, stop, and restart services as with sysVinit, but also have access to much more information and functionality.

Expect legacy commands to be deprecated!

systemctl fully replaces traditional utilites like service and chkconfig. While some services can still be administered with these legacy commands, all services can be administered with systemctl.
/usr/bin/systemctl does most of the heavy lifting when starting and stopping services, or configuring them to run at boot. Let us look at what systemctl can do:

F.9.1. Checking up on services



[root@fedora ~]# systemctl status sshd.service
sshd.service - OpenSSH server daemon
	  Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled)
	  Active: inactive (dead) since Thu, 20 Sep 2012 22:56:55 -0600; 17s ago
	 Process: 971 ExecStart=/usr/sbin/sshd -D $OPTIONS (code=exited, status=0/SUCCESS)
	 Process: 941 ExecStartPre=/usr/sbin/sshd-keygen (code=exited, status=0/SUCCESS)
	  CGroup: name=systemd:/system/sshd.service

Sep 20 19:17:02 fqdn.fedora.lan sshd[23515]: pam_unix(sshd:auth): authentication ...3
Sep 20 19:17:03 fqdn.fedora.lan sshd[23515]: Failed password for invalid user usr...2
Sep 20 19:17:04 fqdn.fedora.lan sshd[23515]: Received disconnect from 192.168.1.....]
Sep 20 19:17:06 fqdn.fedora.lan sshd[23517]: Invalid user db2inst1 from 192.168.1...]
Sep 20 19:17:06 fqdn.fedora.lan sshd[23517]: input_userauth_request: invalid user...]
Sep 20 19:17:06 fqdn.fedora.lan sshd[23517]: pam_unix(sshd:auth): check pass; use...n
Sep 20 19:17:06 fqdn.fedora.lan sshd[23517]: pam_unix(sshd:auth): authentication ...3
Sep 20 19:17:08 fqdn.fedora.lan sshd[23517]: Failed password for invalid user db2...2
Sep 20 19:17:08 fqdn.fedora.lan sshd[23517]: Received disconnect from 192.168.1.....]
Sep 20 22:56:55 fqdn.fedora.lan sshd[971]: Received signal 15; terminating.

The command systemctl status sshd.service can tell us much more than if the service is running. In this example with sshd, we can see that the service is enabled but not active. We know how the service was invoked, what the PID was, and when it was stopped. We can also see the last portion of the service's log.