我有一个类似于下面的代码数组。
$ssh->exec('mkdir /root/example');
$ssh->exec('wget -q -P /root http://www.example.com/example.tar.bz2');
$ssh->exec('tar -xjf /root/example.tar.bz2 -C /root/example');
$ssh->exec('rm /root/example.tar.bz2');我的问题;
下一个命令是在wget和tar命令完成之前启动的。如何等待wget和tar命令的完成?
我试过了;
$ssh->exec('mkdir /root/example');
$ssh->exec('wget -q -P /root http://www.example.com/example.tar.bz2');
sleep(10);
$ssh->exec('tar -xjf /root/example.tar.bz2 -C /root/example');
sleep(10);
$ssh->exec('rm /root/example.tar.bz2');我试过睡眠指令。但不是工作。
编辑:我的英语很差。
发布于 2018-05-08 00:56:27
尝试做$ssh->setTimeout(0);。默认情况下,phpseclib在10之后超时。将超时设置为0将使phpseclib不超时。PHP可能不会,但phpseclib不会。
https://stackoverflow.com/questions/50219972
复制相似问题