简体   繁体   English

带有 URL 参数的 cron 作业在 cpanel 中不起作用

[英]A cron job with a URL parameter is not working in cpanel

I have added the following cron job URL with a parameter in cpanel, but it is not working.我在 cpanel 中添加了以下带有参数的 cron 作业URL ,但它不起作用。

0 * * * * php http://www.example.com/cron.php?instance=0

After searching a lot I changed this as follows.经过大量搜索后,我将其更改如下。

0 * * * * php /home/username/public_html/cron.php?instance=0

But this is also not working for me.但这对我也不起作用。

0 * * * * php /home/username/public_html/cron.php?instance=0

Some of server can not read the cron job URL with a parameter.某些服务器无法读取带有参数的 cron 作业 URL。 They read the parameter if you use parameter as follows.如果您按如下方式使用参数,它们会读取参数。

0 * * * * php /home/username/public_html/cron.php instance=0

This works for me!这对我有用!

Try:尝试:

0 * * * * curl --silent --compressed http://www.mysite.com/cron.php?instance=0

Or.或者。

0 * * * * /usr/bin/curl --silent --compressed http://www.mysite.com/cron.php?instance=0

I hope it helps somewhat.我希望它有所帮助。

你可以试试这个:

/usr/bin/php -q /home/username/public_html/yourfilename.php

You can simply use quotes.您可以简单地使用引号。

For example:例如:

CURL "http://www.example.com/cron.php?instance=0"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM