[SOLVED] How to use "pct exec" ? It doesn't seem to work.

tessus

Active Member
Oct 5, 2020
39
4
28
Toronto, Canada
I've been reading the documentation, but I don't get pct exec to work.

The documentation seems a bit off as well. It says: pct exec <vmid> [<extra-args>] [OPTIONS]
Hmm, so where is the command supposed to go? How does escaping|piping work? There are no examples whatsoever in the entire documentation.

All of the following commands I ran do not work:

Code:
pct exec 803 uname -a >t
pct exec 803 "uname -a >t"
pct exec 803 'uname -a >t'
pct exec 803 "echo 'test' |cat >/tmp/t"
pct exec 803 'echo "test" |cat >/tmp/t'

In fact, I haven't been able to run any pct exec command. So how does it work?
 
Hmm, ok, let me try this again:

I want to run the following command in the container via pct exec: echo "test" |cat >/tmp/t

Thus after running this command there should be a file t in the /tmp directory of the container.
 
Perfect, that worked. Btw, I wrote the command this way on purpose. It's supposed to test using quotes, a pipe, and a redirect. ;-)

The following worked: pct exec 803 -- bash -c 'echo "test" |cat >/tmp/t'
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!