note 73340 added to function.ssh2-exec

From: Date: Sun, 18 Feb 2007 20:00:02 +0000
Subject: note 73340 added to function.ssh2-exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-123555@lists.php.net to get a copy of this message
If the ssh2_exec takes awhile to run, and you need a handshake, you can use a file. In this case, $flag names a handshake file that is written when the ssh script finishes. $stream = ssh2_exec($connection, $command . " $public_key $private_key;"); $i=0; while (!file_exists ($flag) && ($i < MAX_TIME)) { sleep(1); $i++; } $ret_val=($stream!=FALSE); This is an extract out of the bash script that is running. Be sure to allow the webserver permission to read the file that the script writes. echo 0 > $OUTFILE chmod 666 $OUTFILE One other note: you can put more than one command in by separating them with ';' (semicolons). ---- Server IP: 216.194.113.175 Probable Submitter: 70.109.140.149 ---- Manual Page -- http://www.php.net/manual/en/function.ssh2-exec.php Edit -- https://master.php.net/note/edit/73340 Del: integrated -- https://master.php.net/note/delete/73340/integrated Del: useless -- https://master.php.net/note/delete/73340/useless Del: bad code -- https://master.php.net/note/delete/73340/bad+code Del: spam -- https://master.php.net/note/delete/73340/spam Del: non-english -- https://master.php.net/note/delete/73340/non-english Del: in docs -- https://master.php.net/note/delete/73340/in+docs Del: other reasons-- https://master.php.net/note/delete/73340 Reject -- https://master.php.net/note/reject/73340 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#123555) next »