From 976581e983d1dd23122b66d0e57e62896e2e7f2e Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Tue, 29 Aug 2017 15:54:12 +0200 Subject: [PATCH] Adjust timeout in events response commands --- pandora_console/include/ajax/events.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index 09e9642893..cad5efae1a 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -136,12 +136,19 @@ if ($perform_event_response) { echo "Only stdin/stdout commands are supported"; } else { -html_debug("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " \"" . $command . " 2>&1\"", true); - $exec_val = system("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " \"" . io_safe_output($command) . " 2>&1\"", $ret_val); + switch (PHP_OS) { + case "FreeBSD": + $timeout_bin = '/usr/local/bin/gtimeout'; + break; + case "NetBSD": + $timeout_bin = '/usr/pkg/bin/gtimeout'; + break; + default: + $timeout_bin = '/usr/bin/timeout'; + break; + } - ob_clean(); - - echo $exec_val; + echo system("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " \"" . $timeout_bin . " 90 " . io_safe_output($command) . " 2>&1\"", $ret_val); } } else { @@ -156,7 +163,7 @@ html_debug("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " \"" . $com $timeout_bin = '/usr/bin/timeout'; break; } - echo system($timeout_bin . ' 9 '.io_safe_output($command).' 2>&1'); + echo system($timeout_bin . ' 90 '.io_safe_output($command).' 2>&1'); } } else { @@ -171,7 +178,7 @@ html_debug("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " \"" . $com $timeout_bin = '/usr/bin/timeout'; break; } - echo system($timeout_bin . ' 9 '.io_safe_output($command).' 2>&1'); + echo system($timeout_bin . ' 90 '.io_safe_output($command).' 2>&1'); } return;