note 103453 added to function.ssh2-exec
| From: | MicheleBonera at osu1 dot php dot net | Date: | Thu, 14 Apr 2011 10:22:29 +0000 |
| Subject: | note 103453 added to function.ssh2-exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-178820@lists.php.net to get a copy of this message | ||
Please notice that there is undocumented feature in ssh2_exec to fetch the exit status of the
submitted command:
<?php
// Opening connection
$connection = ssh2_connect('remotehost', 22);
ssh2_auth_password($connection, 'user', 'pass');
// Sumbitting command
$stream = ssh2_exec($connection, 'test_command.sh');
$errorStream = ssh2_fetch_stream($stream, SSH2_STREAM_STDERR);
// Enable blocking for both streams
stream_set_blocking($errorStream, true);
stream_set_blocking($stream, true);
// Getting exit status
$exitStatus = ssh2_get_exit_status($stream);
echo "Exit status is: $exitStatus";
?>
----
Server IP: 81.88.49.26
Probable Submitter: 81.174.4.77
----
Manual Page -- http://www.php.net/manual/en/function.ssh2-exec.php
Edit -- https://master.php.net/note/edit/103453
Del: integrated -- https://master.php.net/note/delete/103453/integrated
Del: useless -- https://master.php.net/note/delete/103453/useless
Del: bad code -- https://master.php.net/note/delete/103453/bad+code
Del: spam -- https://master.php.net/note/delete/103453/spam
Del: non-english -- https://master.php.net/note/delete/103453/non-english
Del: in docs -- https://master.php.net/note/delete/103453/in+docs
Del: other reasons-- https://master.php.net/note/delete/103453
Reject -- https://master.php.net/note/reject/103453
Search -- https://master.php.net/manage/user-notes.php