How to run a script on destroy

Hi!

I was wondering what’s the best way to add a script to run when the VM is destroyed. I have zero experience with ansible and know just enough Vagrant to get by. I just want to run wp db export inside the VM before destroying it to avoid accidents.

Thanks!

https://github.com/emyl/vagrant-triggers is probably the only/best way to do this.

Be warned it’s kind of unmaintained though so you may run into issues for newer Vagrant versions.

Worked like a charm. Thanks!