2015-09-16 09:32
浏览 94


I can run a php script which is located in linux server as follows:


$ssh = new Net_SSH2('ip address');
if (!$ssh->login('user name', 'password')) {
    exit('Login Failed');

echo $ssh->exec('/usr/bin/nohup php  /path/to/script/run.php > /path/to/log/run_log.log 2>&1 &');

Now I need to add some code as follows so that it will reply finish of the job.

$output = shell_exec('if [ $? -eq "0" ];then echo "All done" else echo "Not Work" fi');
echo $output;

But it is not working. Means run.php runs in linux server but when it is finished, $output does not print anything. Could you please help?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题