Hi everyone.
I developing Proxmox automation module for WHMCS. I want to add exec command from panel. I can execute commands fine. But when i want to write file this output with bash redirection I have a error.
This error be like in PHP code with var_export function:
I try PHP code and CLI.
My PHP code:
and CLI command:
I had this error in CLI:
How can i solve it?
Thank you.
I developing Proxmox automation module for WHMCS. I want to add exec command from panel. I can execute commands fine. But when i want to write file this output with bash redirection I have a error.
This error be like in PHP code with var_export function:
PHP:
array ( 'exited' => 1, 'err-data' => 'date: extra operand â/home/denemedir.txtâ Try \'date --help\' for more information. ', 'exitcode' => 1, )
I try PHP code and CLI.
My PHP code:
PHP:
$path = "/nodes/{$node}/qemu/{$vmid}/agent/exec";
$data = [
'command' => 'date > /home/denemedir.txt',
];
$send_command = $pve->post($path, $data);
if($send_command === false){
logActivity(var_export($pve->debugInfo, true), 0);
}
while(true){
$path = "/nodes/{$node}/qemu/{$vmid}/agent/exec-status?pid=".$send_command['pid'];
$check_command = $pve->get($path, []);
if($check_command === false){
logActivity(var_export($pve->debugInfo, true), 0);
break;
}
if($check_command['exited'] == 1){
break;
}
}
logActivity(var_export($check_command, true), 0);
$get_output = $pve->get("/nodes/{$node}/qemu/{$vmid}/agent/file-read?file=/root/denemedir.txt", []);
logActivity(var_export($get_output, true), 0);
if($get_output === false){
logActivity(var_export($pve->debugInfo, true), 0);
}
and CLI command:
PHP:
pvesh create /nodes/server/qemu/3258/agent/exec --command "date > denemedir.txt"
I had this error in CLI:
PHP:
pvesh create /nodes/server/qemu/3258/agent/exec --command "date > denemedir.txt"
Wide character in die at /usr/share/perl5/PVE/RESTHandler.pm line 869.
Agent error: Guest agent command failed, error was 'Failed to execute child process “date > denemedir.txt” (No such file or directory)'
How can i solve it?
Thank you.
Last edited: