Gracefully shutting down Xenserver from command line - Advice

Hi Experts,

I have xcpng running in my home server. It has 5 running vms, pfsense, truenas,ubuntu and xen orchestra.

My scenario is I have to shutdown xcpng server when there is a power failure in my home. My node red service running in Ubuntu server can sense a power failure and can trigger a script via ssh.

Can I just ssh into my xcpng server and trigger “shutdown -h now” ? Will that shutdown all vms gracefully? and then shutdown the xcpng server itself?

Currently I have been using “Emergency Mode” in xen orchestra which gets the job done. But I am not sure how to trigger Emergency Mode via CLI.

Any help is greatly appreciated.

[Note: The command will be triggered from node red which lives in the ubuntu server which itself is running as a vm in xcpng]

They have a discussion in their forums on how to do that XCP-ng and Tripp-Lite UPS | XCP-ng forum

1 Like

Thanks Tom !

Looks like the script loops and finds all running VMs and shuts them down one by one and finally host is shutdown.

I am going to trigger this script from a VM which is inside XCPNG so will it loose connectivity while executing the script?

Do you think running "init 0 " will break anything?

Not sure, ask in their forum post.

1 Like

Sure, Thanks for the quick response !