qm-wait:tldr:afe21
This command is a script for shutting down a virtual machine (VM) using the "qm" command-line tool. Let's break it down step by step:
-
qm shutdown ${vm_id}
: This part of the command initiates the shutdown process for a specific VM identified byvm_id
. The${vm_id}
is a placeholder, and you would need to replace it with the actual ID of the VM you want to shut down. Theqm shutdown
command sends a shutdown signal to the VM, encouraging it to gracefully shut down any running processes and prepare for the shutdown. -
&&
: This is a control operator used to combine two commands in a way that the second command (qm wait
) will only execute if the first command (qm shutdown
) is successful. It acts as a logical "AND" operator. -
qm wait --timeout ${10} ${vm_id}
: This part of the command waits for the VM to fully shutdown. Theqm wait
command is used to pause the script execution until the VM identified byvm_id
has completely shut down. The--timeout
option specifies the maximum time to wait for the VM shutdown, and${10}
is a placeholder for the amount of time to wait (in this case, 10 seconds). You would need to replace${10}
with the desired timeout period.
In summary, this command initiates the shutdown of a VM, and if the shutdown is successful, it waits for the VM to completely shut down within a specified timeout period before proceeding with the rest of the script.