-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
-----END PGP SIGNATURE-----
Is it possible to know from a script called via a systemd.service whether a stop
action was manually triggered (systemctl) or as part of shutdown/reboot or poweroff?
Right now (at least Wily+Xenial) there is a non fatal but annoying problem with
Xen. On shutdown/reboot systemd tries to unmount several file systems. One of
which is /proc/xen. Right now Xen still uses /etc/init.d/xen for start/stop. The
same script is also called via invoke-rc.d from *.prerm/*.postinst (which might
be another place to modernize at some point). And because of that there is one
daemon (xenstored) that must be kept running on stop (otherwise state info on
guests running during the upgrade is lost). And since xenstored keeps the
/proc/xen mount busy there is always a failed unmount on shutdown/reboot.
Harmless but not pretty. So I wondered whether I might be able to improve this
for Xenial. And for doing that I might as well introduce a proper xen.service.
Maybe I could use something like "systemctl is-system-running" though that might
be ugly. So I thought I better ask whether anybody had a similar problem and
solved it nicely in the past.