问题描述
我尝试做一个 cron 并每 5 分钟运行一个 url.
I tried to do a cron and run a url every 5 mintues.
我尝试使用 WGET 但我不想下载服务器上的文件,我只想运行它.
I tried to use WGET however I dont want to download the files on the server, all I want is just to run it.
这是我使用的(crontab):
This is what I used (crontab):
*/5 * * * * wget http://www.example.com/cronit.php
除了 wget 之外,还有其他命令可以用来运行 url 而不是下载它吗?
Is there any other command to use other than wget to just run the url and not downlaod it?
推荐答案
您可以通过几种不同的方式告诉 wget 不要下载内容:
You could tell wget to not download the contents in a couple of different ways:
wget --spider http://www.example.com/cronit.php
它只会执行 HEAD 请求,但可能会执行您想要的操作
which will just perform a HEAD request but probably do what you want
wget -O /dev/null http://www.example.com/cronit.php
将输出保存到/dev/null(一个黑洞)
which will save the output to /dev/null (a black hole)
您可能还想查看 wget 的 -q 开关,这会阻止它创建输出
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
除非你有一些特殊的逻辑来检查用于请求页面的 HTTP 方法
that's unless you have some special logic checking the HTTP method used to request the page
这篇关于使用 WGET 运行 cronjob PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!



大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)