4

I am running KVM as virtualization engine.

Is there a way to make QEMU/libvirt run a script on the host when a guest is shutdown from within (shutdown -h now)?

I want to be able to run some custom clean-up tasks when a guest is stopped.

4

libvirt provides the possibility to use hooks for specific system management:

At present, there are three hook scripts that can be called:

    /etc/libvirt/hooks/daemon

    Executed when the libvirt daemon is started, stopped, or reloads its configuration

    /etc/libvirt/hooks/qemu

    Executed when a QEMU guest is started, stopped, or migrated

    /etc/libvirt/hooks/lxc

    Executed when an LXC guest is started or stopped
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.