我scree.php
在路径中有一个文件:
xxx/.../Home/scree.php
我想每 5 分钟执行一次,并确保它是线程安全的。怎么做?
我在 XShell 下。
您可以在 XShell 中编辑 crontab:
crontab -e
然后在文件中,您应该添加代码:
*/5 * * * * root usr/bin/php xxx/.../Home/scree.php
然后 esc:wq
退出文件。
如果显示:
crontab: installing new crontab
意味着成功。
可以使用 crontab 来完成。
粘贴以下代码:
*/5 * * * * php /Home/scree.php
在此处了解有关 crontab的更多信息。