doutang3760 2014-05-22 10:42
浏览 87
已采纳

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

I am running a cronjob every 30 minutes from my shared hosting to another of my ec2 server using the following command:-

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

The cron job does run every 30 minutes based on the emails I am receiving from the Cron Daemon. But then the PHP file seems to be called sometimes only. I noticed that it's only successful when the HTTP request is sent in the Cron Daemon email I receive.

Examples are shown below:-

Unsuccessful Attempts

 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>

Successful Attempts

 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>

How can I make sure that the HTTP request is sent each time the cron daemon runs?

  • 写回答

1条回答 默认 最新

  • douruobokui58233 2014-05-22 10:57
    关注

    You could try forcing a dump however this will also dump all the HTML from the page.. Might not be applicable. -dump dumps the formatted output of the default document or one specified on the command line to standard out. Under UNIX this can be used in the following way:

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

    Or

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

    Alternatively you could try wget with several tries to ensure full response ..

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

    Again you could try cURL :

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

    Any of these options viable for you ?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line