|
|
@@ -794,9 +794,13 @@ chmod 600 ~/.ssh/authorized_keys;
|
|
|
//$cmd = "ssh -i ~/.ssh/id_rsa server@{$appLicenceInfo->mainServer} 'ls -1'";
|
|
|
$sshPort = (22 != $appLicenceInfo->sshPort)? "-p {$appLicenceInfo->sshPort}" : '';
|
|
|
$cmd = "ssh {$sshPort} {$appLicenceInfo->rootLogin}@{$appLicenceInfo->mainServer} 'ls -1'";
|
|
|
- V::exec($cmd, $out, $ret);
|
|
|
+ V::exec("$cmd 2>&1", $out, $ret); // http://php.net/manual/pl/function.exec.php says I saw the exec, system, shell_exec and passthru functions,
|
|
|
+ //and deduced that the solution was to
|
|
|
+ //redirect the standard error (stderr) to the standard output (stdout). It's not very clean, since it mixes stderr with stdout, and I only wanted to log the stderr.
|
|
|
+ //But it seems to be the only solution (suggestions are welcome).
|
|
|
+
|
|
|
DBG::_(true, true, "cmd: {$cmd} (return: {$ret})", $out, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
- if (0 !== $ret) throw new Exception("Cannot run remote command using rsa key! #{$ret}. Cmd: {$cmd}");
|
|
|
+ if (0 !== $ret) throw new Exception("Cannot run remote command using rsa key! #{$ret}; Out: {$out}; Cmd: {$cmd};");
|
|
|
}
|
|
|
|
|
|
|