March's Systemd Presentation
Bernie Hoefer
LUG-Member at TheMoreIKnow.info
Wed Apr 1 18:29:44 EDT 2015
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
During my presentation, Garrett Honeycutt asked what systemd would
do if 2 services were set up to require the other be started before the
other. I gave it a quick try; here are my results.
I installed the httpd (Apache) package, copied its systemd service
file from /usr/lib/systemd/system to /etc/systemd/system and edited it
to start up after Postfix. I then copied & edited the Postfix systemd
service file to start up after httpd:
[root at localhost ~]# grep After /etc/systemd/system/httpd.service /etc/systemd/system/postfix.service
/etc/systemd/system/httpd.service:After=network.target remote-fs.target nss-lookup.target postfix.service
/etc/systemd/system/postfix.service:After=syslog.target network.target httpd.service
After rebooting, I logged in and saw that httpd had started, but
postfix had not:
[root at localhost ~]# systemd-analyze critical-chain
The time after the unit is active or started is printed after the "@" character.
The time the unit takes to start is printed after the "+" character.
multi-user.target @13.706s
└─httpd.service @12.631s +1.069s
└─network.target @12.571s
└─network.service @9.166s +3.399s
└─NetworkManager.service @8.745s +417ms
└─firewalld.service @5.029s +3.712s
└─basic.target @5.013s
└─paths.target @5.006s
└─brandbot.path @5.006s
└─sysinit.target @4.981s
└─systemd-update-utmp.service @4.929s +45ms
└─auditd.service @4.726s +177ms
└─systemd-tmpfiles-setup.service @4.533s +166ms
└─rhel-import-state.service @4.302s +217ms
└─local-fs.target @4.283s
└─boot.mount @2.881s +1.393s
└─dev-disk-by\x2duuid-b3fca660\x2dab60\x2d4853\x2d
[root at localhost ~]# systemctl -l status postfix.service
postfix.service - Postfix Mail Transport Agent
Loaded: loaded (/etc/systemd/system/postfix.service; enabled)
Active: inactive (dead)
Mar 31 22:26:04 localhost.localdomain systemd[1]: Job postfix.service/start deleted to break ordering cycle starting with httpd.service/start
[root at localhost ~]# ll /etc/systemd/system/*service
lrwxrwxrwx. 1 root root 41 Mar 31 21:55 /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service -> /usr/lib/systemd/system/firewalld.service
lrwxrwxrwx. 1 root root 46 Mar 31 21:54 /etc/systemd/system/dbus-org.freedesktop.NetworkManager.service -> /usr/lib/systemd/system/NetworkManager.service
lrwxrwxrwx. 1 root root 57 Mar 31 21:54 /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service -> /usr/lib/systemd/system/NetworkManager-dispatcher.service
- -rw-r--r--. 1 root root 710 Mar 31 22:21 /etc/systemd/system/httpd.service
- -rw-r--r--. 1 root root 477 Mar 31 22:21 /etc/systemd/system/postfix.service
[root at localhost ~]# systemctl -l status httpd.service
httpd.service - The Apache HTTP Server
Loaded: loaded (/etc/systemd/system/httpd.service; enabled)
Active: active (running) since Tue 2015-03-31 22:26:17 EDT; 2min 13s ago
Main PID: 1037 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: /system.slice/httpd.service
├─1037 /usr/sbin/httpd -DFOREGROUND
├─1118 /usr/sbin/httpd -DFOREGROUND
├─1119 /usr/sbin/httpd -DFOREGROUND
├─1121 /usr/sbin/httpd -DFOREGROUND
├─1122 /usr/sbin/httpd -DFOREGROUND
└─1123 /usr/sbin/httpd -DFOREGROUND
Mar 31 22:26:17 localhost.localdomain httpd[1037]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
Mar 31 22:26:17 localhost.localdomain systemd[1]: Started The Apache HTTP Server.
I haven't had time to investigate why systemd allowed httpd to
start even though postfix had not, but it is obvious from the postfix
status output that it detected the mis-configuration. I'll let you
know why/how it picked to drop postfix and go with httpd after a
little more investigation. :-)
- --
Bernie Hoefer
PGP e-mail is welcome! Get my 1024 bit signature key from:
<http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x446A6F93>.
"The more I know, the more I realize how much I do not understand."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iEYEARECAAYFAlUccVYACgkQckGmqURqb5OlFwCfU/bAChPy96UyKsKX1RakMsfS
RhoAn1UbzoNUz/QuhkB+aYEFyzlT4xMA
=yd9z
-----END PGP SIGNATURE-----
More information about the cinlug
mailing list