兄弟好,
我刚接触服务器端,在Centos上设置了定时Cron,每5分钟发一次邮件。
用Crontab -e和 crontab -l检查均显示该cron 正常,并且设置了向我qq邮箱发送提醒的邮件。如下:
# send test email to my adddresses every 5 minutes
MAILTO="248672*****@qq.com"
*/5 * * * * /var/www/html/application/controller/email_temporary.php
但实际上发送的任务邮件和提醒邮件均从没有收到。
不知为何?
谢谢!
谢谢大家解答!最后问题发现由于CI的特殊架构必须通过index.php才能运行cron。最后方法:*/5 * * * * php /var/www/html/index.php email_temporary
First try to run
/var/www/html/application/controller/email_temporary.php
directly under the shell to see if you can send letters normally. I seriously suspect that this program does not work as you imagine.The program itself can add logs and then look in the /var/log/ directory to see if there is a cron log or if there is some information in the message
tail /var/log/cron can see the recently run cron records
Thank you everyone for your answers! Finally, the problem was discovered that due to the special architecture of CI, cron must be run through index.php. Last method: */5 * * * * php /var/www/html/index.php email_temporary