script to shutdown VM on power button press

kisiel

Member
May 13, 2023
24
0
6
Hi. I use Mac vm (no guest agent).
My idea is that when I press power button proxmox could send shutdown command to OSX via ssh.
This would should allow to close mac vm gracefully.
I am not sure what is happening now, but I have a feeling that mac simply sees it as yanking the cable off the mains.

any ideas?
 
Should be doable with acpid.

Shutting down a VM should also be possible without the guest agent. You can always send a ACPI shutdown to the KVM process and the guest OS could respond to that. Needs checking on MacOS, yet in theory it could work.
 
so you mean that MacOS should close down gracefully just based on ACPI shutdown signal.
you might be right, I am not sure how to prove it though
 
Simple, close down all programs on your mac-vm, then within proxmox press the shutdown or restart option (NOT stop/reset) while looking at the console. If you see if it shutting down cleanly and it also starts up without error there, you should be good with the power-button too. If not, you've got to "fix" your mac-vm first.

(the closing down programs is so that IF it does crash, the chance of any corruption is negligible low, but if you want to be extra sure, make a snapshot/clone first)
 
Last edited: