1

I am writing a task which will be ran by as a Cron Job. I want the function to check if a file has been downloaded to the server yet. The time stamp check is fine, however what is the best way to make the check loop run every 15 minutes? Could I use sleep and then check the current time stamp againsed the time stamp I want the loop to terminate (5am)?

Cheers.

4

1 回答 1

2

这就是 cron 所做的。Crontab 允许您设置运行脚本的时间间隔。很容易指定 15 分钟的间隔。这样您就不必担心睡眠或错误恢复或 php 脚本中的任何内容,只需担心您的逻辑。

http://www.electrictoolbox.com/run-cron-command-every-15-minutes/

于 2012-08-23T13:04:10.253 回答