2014-05-10 09:01
浏览 30


A script has an execution time of more than a minute. So, therefore I would like to run the script as a background task.

I've read a lot about it on the internet and read that print shell_exec('/usr/bin/php -q page.php &'); isn't the solution since the taks is still a child of the process. I've tested it with sleep(10) and indeed, the page which should call the cron job is waiting for 10 seconds.

So, symcbean have written an article ( http://symcbean.blogspot.nl/2010/02/php-and-long-running-processes.html?m=1 ) and is suggesting the following code:

print `echo /usr/bin/php -q longThing.php | at now`;

But, unfortunately, i script didn't do anything and after adding 2>&1 I get the following response:

sh: at: command not found

I've search a lot for solving this issue, but can't find any solution.

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

1条回答 默认 最新

相关推荐 更多相似问题