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 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号