![]() ![]() Because the service type is oneshot, Systemd will wait until the script exits before it continues with its standard shutdown process. The graceful-shutdown service will cause Systemd to run a Linux shell script, /sbin/stoplab.sh before Systemd stops the libvirt-guests service. Then, enable and start the service with the commands: # systemctl enable graceful-shutdown The rvice unit configuration fileĬreate a new Systemd unit configuration file named rvice and save it in the directory, /etc/systemd/system, where it is advised you put custom configuration files.įor example: # vi /etc/systemd/system/rviceĮnter the following text into the file, then save it: Create a new Systemd service named graceful-shutdown that runs a script when the host system shuts down, but before Libvirt shuts down any virtual machines. Ensure that the libvirt-guests service is already started and enabled, and is configured appropriately. Read on to see the solution, plus some details about how to test the solution in Ubuntu and CentOS. I had to learn how Systemd service unit configuration files work and some more details about how Libvirt is configured in different Linux distributions. I will configure the host server to wait until the script completes configuring the virtual machines before continuing with the shutdown process, shutting down the virtual machines, and eventually powering off. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |