On a KVM host I have a few VMs with legacy OSes that do not listen to ACPI shutdown event. As it happens on Debian 9.5 host, on shutdown the
libvirt-guests.service waits for 5 minutes for each such VM and then destroys it.
In order to avoid that and shut them down cleanly, I have created custom VM shutdown service, with a script that uses special methods to shut them down:
% cat /etc/systemd/system/multi-user.target.wants/vm_stop.service [Unit] Description=vm_shutdown Before=libvirt-guests.service [Service] ExecStart=/bin/true ExecStop=/usr/local/bin/vm_shutdown_all.sh [Install] WantedBy=multi-user.target
However, on shutdown the service appears to run after
libvirt-guests.service in spite of the
Before= settings in above service.
Now, I have tested that the custom service actually does run on shutdown - it
touches a test file where I can verify it.
The problem: how do I ensure that it runs before