Previous page

Next page

Locate page in Contents

Print this page

pctl exec, pctl exec2, and pctl enter

These commands are used to run arbitrary commands in a Container being authenticated as root on the server. The syntax of these commands is as follows:

pctl { exec|exec2 } < CT_ID|name > < command >

pctl enter < CT_ID|name >

where command is a string to be executed in the Container. If command is specified as “ - ” then the commands for execution will be read from the standard input until the end of file or “exit” is encountered.

The difference between exec and exec2 is the exit code. pctl exec returns 0 in case pctl has been able to launch the command and does not take into account the exit code of the command itself. pctl exec2 returns the exit code of the command executed in the Container.

When using exec or exec2 , you should remember that the shell parses the command-line and, if your command has shell meta-characters in it, you should escape or quote them.

pctl enter is similar to pctl exec /bin/bash . The difference between the two is that pctl enter makes the shell interpreter believe that it is connected to a terminal. As such, you receive a shell prompt and are able to execute multiple commands as if you were logged in to the Container.