[systemd-devel] Cannot get Shutdown Script to Run (Libvirt Virtual Machine Shutdown)

Tobias Geerinckx-Rice tobias.geerinckx.rice at gmail.com
Mon Sep 22 06:06:33 PDT 2014


On 22 September 2014 07:57, Alexander Groleau <awgneo at xbetanet.com> wrote:
> I have tried the following script as well during my adventures with no
> success:
>
> [Unit]
> Description=Start/Stop Libvirt Windows Guest
> Documentation=man:libvirtd(8)
> Documentation=http://libvirt.org
> After=libvirtd.service

Manually ordering services with Before=/After= is usually a mistake.
Try using Requires= or BindTo= instead, and let systemd handle
ordering for you.

> [Service]
> ExecStart=/usr/bin/libvirt-windows.sh start
> ExecStop=/usr/bin/libvirt-windows.sh stop
> RemainAfterExit=yes
> Type=oneshot
> StandardOutput=journal+console
>
> [Install]
> WantedBy=multi-user.target
>
> This works for boot (my sh script is run right after libvirtd is started);
> however, the libvirtd daemon, started by libvirtd.service, is always
> terminated well before my sh is run on shutdown/reboot.

I can't see any other obvious problems. This should just work, unless
something other than systemd is killing your libvirtd.

Regards,

T G-R


More information about the systemd-devel mailing list