API equivalent of qm guest exec

Hyien

Member
Jun 18, 2021
94
2
13
34
what's the api of pvesh equivalent of qm guest exec?

eg. qm guest exec 100 '/bin/ls' -- '-ald' '/tmp'

i tried pvesh create /nodes/xxx/qemu/100/agent/exec -command 'ls -ald /tmp', but it's giving me an error:
Wide character in die at /usr/share/perl5/PVE/RESTHandler.pm line 869.

also, i noticed qm shows the command output, but pvesh returns just the pid
 
you have to specify the 'command' arg for each part of the command:
Code:
pvesh create /nodes/xxx/qemu/100/agent/exec -command 'ls' --command '-ald' --command '/tmp'

and then feed the pid into exec-status (qm guest exec does this by default)
Code:
pvesh get /nodes/xxx/qemu/100/agent/exec-status --pid 12345
 

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!