I want to get the exit status of ssh2_exec command.I tried following code but it it is giving me the output of jar file but i want only the status for success or failure.How can i get that, please help.
$stream = ssh2_exec($connection, 'path of jar file');
stream_set_blocking($stream,true);
$output = ssh2_fetch_stream($stream,SSH2_STREAM_STDIO);
echo stream_get_contents($output);
You should use stderr instead:
$output = ssh2_fetch_stream($stream,SSH2_STREAM_STDERR);
If there are no errors, it's a success.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.