简体   繁体   English

在cron中命令每隔一分钟运行php

[英]command in cron to run php every certain mins

this might be a repeat. 这可能是一个重复。
i would like to run my index.php every certain mins. 我想每隔一分钟运行我的index.php。 My server has option run cron command/ cron jobs. 我的服务器有选项运行cron命令/ cron作业。 Someone please tell me what could should I use to schedule. 有人请告诉我我应该用什么安排。
Thanks in advance. 提前致谢。

First of all, why ? 首先, 为什么

Second, crontab -e will allow you to edit your crontab. 其次, crontab -e将允许您编辑crontab。 Then it's just as easy as 那就简单了

? * * * * php /path/to/index.php

You could use this command 您可以使用此命令

Minutes Hours  Day  Month WeekDay
45      *      *    *     *        php /path/to/index.php *

Here is an article about a php cron manager 这是一篇关于php cron管理器的文章

First, here is how cron works: 首先,这是cron的工作原理:

http://en.wikipedia.org/wiki/Cron http://en.wikipedia.org/wiki/Cron

Then, the comand should look like this: 然后,命令应如下所示:

* * * * * cd /directory/of/the/script/ && php scriptname.php >> /directory/of/the/logfile.log

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM