[英]How to create a cron job to run script from web?
I have created a cron job in a server www.domain.com with CENTOS: 我在CENTOS的服务器www.domain.com上创建了一个cron作业:
*/10 * * * * http://www.anotherdomain.com/cron/task.php
but its returning: 但它的回归:
/bin/sh: http://www.anotherdomain.com/cron/task.php: No such file or directory
How to make it works? 如何使其工作?
*/10 * * * * wget -q -t 5 --delete-after http://www.anotherdomain.com/cron/task.php
q = quiet q =安静
t = retries incase of network issues (5 in this case) t =重试网络问题(在这种情况下为5)
delete-after = we don't actully want the output of the remote page delete-after =我们不想要远程页面的输出
If you prefer curl and here are the reasons you might , your cronjob should be: 如果你喜欢卷曲 ,这就是你可能的原因 ,你的cronjob应该是:
*/10 * * * * curl -s http://www.anotherdomain.com/cron/task.php -o /dev/null
s suppresses any status output from curl and -o redirects it to the file following -- in this case, /dev/null
. s抑制curl的任何状态输出,-o将其重定向到以下文件 - 在本例中为
/dev/null
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.