March 13, 20215 yr Hi everyone, does anyone know if there is a way to automatic shutdown or reboot the unraid server whenever you power off or reboot, from within, a specific VM? Can I edit the XML or maybe write a script..? Sorry if this has been answered before, i could not find anything about it. Thank you!
March 13, 20215 yr Community Expert There is a hooks process within QEMU that can be used. Currently there is only one within unraid and there isn't an easy way to add a VM specific script. File is in /etc/libvirt/hooks and its called qemu. For my plugin users need to Manually update the file. if ($argv[2] == 'prepare' || $argv[2] == 'stopped'){ shell_exec("/usr/local/emhttp/plugins/unraid.usbip-gui/scripts/rc.unraid.usbip-gui vm_action '{$argv[1]}' {$argv[2]} {$argv[3]} {$argv[4]} >/dev/null 2>&1 & disown") ; } https://libvirt.org/hooks.html
March 13, 20215 yr Author Thank you Simon, actually it doesn't need to be VM specific since I only use one VM, and the idea is just that if I shut down that VM the whole system shuts down. Right now i cannot test it, but you are saying that if I install your plugin (and update the quemu) there's a way i can do that from gui? Sorry for the silly question but i'm pretty new to unraid
Archived
This topic is now archived and is closed to further replies.