How to use the command qm reboot (with examples)

How to use the command qm reboot (with examples)

The qm reboot command is used to reboot a virtual machine by shutting it down and starting it again after applying pending changes. This command is particularly useful when you need to restart a virtual machine to apply any configuration changes or system updates.

Use case 1: Reboot a virtual machine

Code:

qm reboot vm_id

Motivation: There may be instances where you need to reboot a virtual machine to resolve certain issues or to ensure that new configurations take effect. By using the qm reboot command, you can easily restart the virtual machine without having to manually shut it down and start it again.

Explanation:

  • qm reboot is the main command.
  • vm_id is the ID of the virtual machine that you want to reboot.

Example Output:

Virtual machine restart initiated for VM 100.

Use case 2: Reboot a virtual machine after waiting for at most 10 seconds

Code:

qm reboot --timeout 10 vm_id

Motivation: In some cases, you may want to set a specific timeout value before rebooting a virtual machine. This can be useful, for example, when you want to give the virtual machine enough time to perform certain tasks or to gracefully shut down before the reboot.

Explanation:

  • qm reboot is the main command.
  • --timeout 10 specifies a timeout value of 10 seconds. This means that the command will wait for at most 10 seconds before forcefully rebooting the virtual machine.
  • vm_id is the ID of the virtual machine that you want to reboot.

Example Output:

Virtual machine restart initiated for VM 100. Waiting for up to 10 seconds for graceful shutdown...

Conclusion:

The qm reboot command provides a straightforward way to reboot virtual machines in a Proxmox environment. Whether you need to restart a virtual machine to apply changes or want to set a specific timeout value, this command offers the necessary flexibility to meet your needs.

Related Posts

How to use the command 'xmlto' (with examples)

How to use the command 'xmlto' (with examples)

The ‘xmlto’ command is a versatile tool that allows you to apply an XSL stylesheet to an XML document.

Read More
Pacman4console: A Text-Based Console Game (with examples)

Pacman4console: A Text-Based Console Game (with examples)

Pacman4console is a text-based console game inspired by the original Pacman.

Read More
How to use the command 'wg' (with examples)

How to use the command 'wg' (with examples)

The wg command is used to manage the configuration of WireGuard interfaces.

Read More