lynx cronjob调用,但HTTP请求未发送

时间:2014-05-22 10:42:34

标签: php linux cron lynx

我使用以下命令每30分钟从共享主机运行一个cronjob到我的另一个ec2服务器: -

0,30 * * * * /usr/bin/lynx http://qwerty.com/crons/myCron.php

根据我从Cron守护程序收到的电子邮件,cron作业每30分钟运行一次。但是,有时只会调用PHP文件。我注意到,只有在我收到的Cron守护程序电子邮件中发送HTTP请求时,它才会成功。

示例如下所示: -

尝试失败

 Your Terminal type is unknown!

 Enter a terminal type: [vt100] 
TERMINAL TYPE IS SET TO vt100
(B)0[1;24r[m[?7h[?1h=[H[J[21B[0;7mGetting http://qwerty.com/crons/myCron.php[m
[0;7mLooking up qwerty.com[m[K
[0;7mMaking HTTP connection to qwerty.com[m

[24;1H
[?1l>

成功尝试

 Your Terminal type is unknown!

 Enter a terminal type: [vt100] 
TERMINAL TYPE IS SET TO vt100
(B)0[1;24r[m[?7h[?1h=[H[J[21B[0;7mGetting http://qwerty.com/crons/myCron.php[m
[0;7mLooking up qwerty.com[m[K
[0;7mMaking HTTP connection to qwerty.com[m
[0;7mSending HTTP request.[m             [22;22H
[0;7mHTTP request sent; waiting for response.[m

[24;1H
[?1l>

如何确保每次运行cron守护程序时都发送HTTP请求?

1 个答案:

答案 0 :(得分:1)

您可以尝试强制转储但是这也会转储页面中的所有HTML。可能不适用。 -dump将默认文档的格式化输出或命令行中指定的输出转储为标准输出。在UNIX下,可以通过以下方式使用它:

lynx -dump http://qwerty.com/crons/myCron.php

或者

/usr/bin/lynx -mime_header -dump http://qwerty.com/crons/myCron.php

或者你可以尝试wget多次尝试以确保完全响应..

/usr/bin/wget −r −−tries=10 http://qwerty.com/crons/myCron.php

再次尝试cURL:

curl http://qwerty.com/crons/myCron.php

这些选项对你有用吗?