【问题标题】:Adding a cronjob into cPanel将 cronjob 添加到 cPanel
【发布时间】:2013-02-28 20:05:52
【问题描述】:

我只需要在我的 cPanel 中使用 cron 作业运行以下 url。

当我尝试执行链接时

http://www.insidewealth.com.au/index.php?option=com_acymailing&ctrl=cron

链接正在浏览器中运行,但是当我尝试添加与 cron 作业中相同的 URL 时,我收到以下错误

bash/sh/ file not found

当我将 cron 作业编辑为

/usr/bin/php /home/staging/public_html/index.php?option=com_acymailing&ctrl=cron

但我收到 404 错误。

我的 cPanel 用户名是 staging

谁能告诉我cPanel中cron作业的语法是什么。

每分钟运行一次 Cron 作业并通过电子邮件报告显示此错误。

【问题讨论】:

  • 你能检查cPanel文件管理器并确认index.php的路径是/home/staging/public_html/吗?
  • @sinisterfrog - 是的,文件在正确的位置。
  • 也可以通过输入which php来检查php的路由。

标签: cron cpanel


【解决方案1】:

使用带有完整 URL 的 wget 函数。

【讨论】:

  • 您能否详细说明您的解决方案?
【解决方案2】:

@yannick-blondeau 正如建议的那样您可以使用 wget 或 curl 向您的网站发出简单的请求。

通常 wget 会尝试下载文件,但这对于 -O 标志来管道到 /dev/null-q (这两个选项都用于防止将输出保存到文件)是不必要的,示例如下喜欢

wget -O /dev/null http://www.insidewealth.com.au/index.php?option=com_acymailing&ctrl=cron
wget -q http://www.insidewealth.com.au/index.php?option=com_acymailing&ctrl=cron

你也可以使用 curl 来达到同样的效果

curl --silent http://www.insidewealth.com.au/index.php?option=com_acymailing&ctrl=cron

【讨论】:

    猜你喜欢
    • 2020-01-24
    • 2017-10-08
    • 2011-04-01
    • 2020-05-19
    • 2019-11-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-12
    相关资源
    最近更新 更多