3.2.13. prlctl start, stop, restart, status

These commands start, stop, restart, and show the current state of containers, respectively.

Syntax. 

prlctl start <CT_name> [--wait]
prlctl stop <CT_name> [--fast]
prlctl restart <CT_name>
prlctl status <CT_name>

Table 3.19. Options

NameDescription

<CT_name>

Container name.

The first command is used to start a container. It will set up all network interfaces inside the container, initialize the container quota, if needed, start the init process inside the container, and exit. You can also make the prlctl start command wait for all the necessary startup processes to complete and the container to boot into the default runlevel by passing the --wait option to this command.

prlctl stop shuts the container down. If the container is not down after a two-minute timeout due to an error in an application, for example, prlctl will forcibly kill all the processes inside the container. To avoid waiting for two minutes in case of a corrupted container, you may use the --fast option with this command.

When starting or stopping a container, prlctl executes a number of helper scripts located in the /vz/private/<CT_UUID>/scripts and /usr/libexec/libvzctl/scripts/ directories.

Table 3.20. Scripts:

NameDescription

vz-create_prvt

This script is expected to create the container private area from a private area template.

vz-net_add

This script sets up the necessary routing entries for container IP addresses and adds public ARP records on all interfaces.

vz-net_del

This script deletes routing entries and ARP records for container IP addresses from all interfaces.

vz-pci_configure

This configuration script is executed after a PCI device is added to or removed from a container.

vz-setrate

This script configures the network traffic shaping for a container.

vz-start

This script is called just before a container is started and used to perform any additional setup of the container, such as network setup.

vz-stop

This script is called just after a container is shut down and can be used to perform any additional cleanup of the container, such as network cleanup.

Use action scripts vz-start/vz-stop to perform actions during container startup/shutdown. To add more functionality to other shipped scripts, create a new script and add a call to it to a shipped script. Doing so will facilitate upgrades to future versions of OpenVZ.

The prlctl restart <CT_name> command consecutively performs the stopping and starting of the corresponding container.

The prlctl status command shows the current container state. It outputs the following information: whether the container private area exists, whether it is mounted, and whether the container is running.