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

tessus

Active Member
Oct 5, 2020
41
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'