使用WGET运行cronjob PHP [英] Using WGET to run a cronjob PHP

查看:202
本文介绍了使用WGET运行cronjob PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做一个cron,并每5分钟运行一个url。



我试图使用WGET,但我不想下载服务器上的文件,所有

这是我使用的(crontab):

* / 5 * * * wget http://www.example.com/cronit.php


b $ b

有没有任何其他命令使用除了wget只是运行的url而不是downlaod它?

解决方案

您可以告诉wget不能以几种不同的方式下载内容:

  wget --spider http:// www .example.com / cronit.php 

这只会执行HEAD请求,

  wget -O / dev / null http://www.example.com/cronit.php 

这会将输出保存到/ dev / null(黑洞)



您可能想看看wget的-q开关,阻止它创建输出



我认为最好的选择可能是:

  wget -q --spider http://www.example.com/cronit.php 

这是除非你有一些特殊的逻辑检查用于请求页面的HTTP方法


I tried to do a cron and run a url every 5 mintues.

I tried to use WGET however I dont want to download the files on the server, all I want is just to run it.

This is what I used (crontab):

*/5 * * * * wget http://www.example.com/cronit.php

Is there any other command to use other than wget to just run the url and not downlaod it?

解决方案

You could tell wget to not download the contents in a couple of different ways:

wget --spider http://www.example.com/cronit.php

which will just perform a HEAD request but probably do what you want

wget -O /dev/null http://www.example.com/cronit.php

which will save the output to /dev/null (a black hole)

You might want to look at wget's -q switch too which prevents it from creating output

I think that the best option would probably be:

wget -q --spider http://www.example.com/cronit.php

that's unless you have some special logic checking the HTTP method used to request the page

这篇关于使用WGET运行cronjob PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆