【问题标题】:Would crontab work like this?crontab 会这样工作吗?
【发布时间】:2015-06-27 10:27:48
【问题描述】:

我这里有一些必须每天每 5 分钟运行一次的 php 脚本。 所以我把这个放到 crontab 中:


*/5 * * * * php curl ht*p://url.url/del/crawl_data.php >/dev/null 2>&1

*/5 * * * * php curl ht*p://url.url/del/delete_channel.php >/dev/null 2>&1

*/5 * * * * php curl ht*p://url.url/rules.php >/dev/null 2>&1

这行得通吗? 我现在正在等待,但什么也没有发生,为什么? 谢谢你的帮助:)

【问题讨论】:

  • 删除 ` >/dev/null 2>&1` 部分并查看消息(用户应该会收到带有输出的本地邮件)。如果您之后需要更多帮助,请将消息添加到您的问题中。
  • 我收到此错误:pastebin.com/raw.php?i=JfCJZra2
  • 是的,但是哪个扩展?我现在必须完全改变 php_cli 上的内容?
  • 我现在从 php 更改为仅 curl,这样可以吗?还是我会留在 php 和 curl?

标签: php linux curl debian crontab


【解决方案1】:

首先你必须检查 crontab 上的“php”是指名为 php 的用户还是 php bin。而不是编辑“ht * p”成为“http”。我建议将执行的输出保存在 /tmp 目录下的文件中。您还必须检查 crontab 的日志以检查脚本是否执行。

现在试试这个:

*/5 * * * * root curl "http://url.url/del/crawl_data.php" >> /tmp/myLogFile

*/5 * * * * root curl "http://url.url/del/delete_channel.php" >> /tmp/myLogFile

*/5 * * * * root curl "http://url.url/rules.php" >> /tmp/myLogFile

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-01-26
    • 2023-02-26
    • 1970-01-01
    • 2021-04-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-04
    相关资源
    最近更新 更多