我试图做一个cron,并每5分钟运行一个url。
我试图使用WGET,但我不想下载服务器上的文件,所有
这是我使用的(crontab): * / 5 * * * wget www.example/cronit.phpb $ b
有没有任何其他命令使用除了wget只是运行的url而不是downlaod它?
解决方案您可以告诉wget不能以几种不同的方式下载内容:
wget --spider http:// www .example / cronit.php这只会执行HEAD请求,
wget -O / dev / null www.example/cronit.php这会将输出保存到/ dev / null(黑洞)
您可能想看看wget的-q开关,阻止它创建输出
我认为最好的选择可能是:
wget -q --spider www.example/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 www.example/cronit.phpIs 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 www.example/cronit.phpwhich will just perform a HEAD request but probably do what you want
wget -O /dev/null www.example/cronit.phpwhich 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 www.example/cronit.phpthat's unless you have some special logic checking the HTTP method used to request the page
更多推荐
使用WGET运行cronjob PHP
发布评论