Linux 如何等待wget和tar命令的完成?
我有一个类似于下面的代码数组Linux 如何等待wget和tar命令的完成?,linux,ssh,phpseclib,Linux,Ssh,Phpseclib,我有一个类似于下面的代码数组 $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'); 我的问题 下一个命令在wg
$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');
我试过睡眠命令。但不是工作
编辑:我的英语不好。尝试执行
$ssh->setTimeout(0)代码>。默认情况下,phpseclib在10秒后超时。将超时设置为0将使phpseclib不会超时。PHP可能会,但phpseclib不会。@MehmetCanErtanLastOfDead-在ssh登录后执行就足够了。每次命令后,超时都会重置为您设置的值。如果将超时设置为30秒,则每个exec()都将有30秒的超时。如果将其设置为0,则没有exec()将超时。