Commit 9f5e0311 by 张思远

add liunux rmote

parent 5f9a4edf
Pipeline #169 passed with stage
in 11 seconds
#!/bin/bash
sshpass -p "Iwillbeback3" ssh -t "www"@8.140.51.18 "cd /www/wwwroot/webhook-test-zsy;git pull"
\ No newline at end of file
...@@ -42,4 +42,34 @@ if ($stderr) { ...@@ -42,4 +42,34 @@ if ($stderr) {
echo '</dl>'; echo '</dl>';
echo 'linux远程:<br>';
$cmd = 'bash t1.sh';
$descriptorspec = [
["pipe", "r"], // stdin
["pipe", "w"], // stdout
["pipe", "w"], // stderr
];
$proc = proc_open($cmd, $descriptorspec, $pipes, null, null);
if ($proc == false) {
// do sth with HTTP response
} else {
$stdout = stream_get_contents($pipes[1]);
fclose($pipes[1]);
$stderr = stream_get_contents($pipes[2]);
fclose($pipes[2]);
$status = proc_close($proc); // 释放proc
}
echo '<dl>';
echo '<dt>输出</dt>';
echo '<dd><pre>' . $stdout . '</pre></dd>';
if ($stderr) {
// echo '<dt>出错了!</dt>';
echo '<dd><pre>' . $stderr . '</pre></dd>';
}
echo '</dl>';
exit; exit;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment