我正在使用Codeigniter开发我的网站,它运行在安装在Ubuntu的Apache上。
我想运行一个cron。我正在使用Codeigniter路由,我也从路由中删除了index.php
。
My controller is home function is winner.
我试了以下两种方法,但似乎没有一个工作。
#49 5 * * * /usr/local/bin/php /var/www/project/web/index.php home winner
13 6 * * * /usr/bin/curl http://www.project.com/home/winner
- 检查您的系统中是否安装了lynx(例如命令"whereis lynx")
- 然后编辑crontab的配置(命令"crontab -e")
- 把这个命令和MAILTO选项放在你的crontab的配置中(按照同样的顺序,第一行是" MAILTO "选项,下一行是其他选项):
MAILTO = your.com
*/5 * * * */usr/bin/lynx -source http://www.project.com/home/winner
通过这些设置,cron将每5分钟启动一次。如果那里会有一些错误,cron会把你在MAILTO选项中设置的地址发送给它。
[在Debian 4.7.2上测试]
在您的cPanel cron作业设置中尝试此操作。每5分钟运行一次:
*/5 * * * * curl http://yoursite.com/class/function
https://www.drupal.org/docs/7/setting-up-cron-for-drupal/configuring-cron-jobs-using-the-cron-command