【发布时间】:2011-07-05 06:42:35
【问题描述】:
我需要每小时和每天发送电子邮件。我几乎尝试了所有方法,但似乎我的 crontab 无法正常工作。如果我通过浏览器运行脚本,例如
http://localhost/Maisha/Functions/sendhourlymails.php
我的电子邮件发送得很漂亮。(我将默认网站 localhost 移动到 public_html。)我不知道出了什么问题。我在堆栈溢出中阅读了一些帖子,包括 php 的可执行路径有帮助,因此我将 /usr/bin/php 放在要执行的实际脚本之前,但它没有。删除 /usr/bin/php 不起作用。在实际脚本不起作用之前添加 php。 我的 crontab 中有以下条目。
# m h dom mon dow command
0 * * * * /usr/bin/php /home/maxwell/public_html/Maisha/Functions/sendhourlymails.php
0 0 * * * /usr/bin/php /home/maxwell/public_html/Maisha/Functions/senddailymails.php
【问题讨论】:
-
如果直接在命令行运行命令会发生什么?
-
在命令行手动运行命令会发生什么?
-
您是否在日志中查找过错误?
-
@Alister 我该怎么做?我是linux环境的新手
-
@Eineki 我该怎么做以及哪些错误日志?