使用WGET运行cronjob PHP

编程入门 行业动态 更新时间:2024-10-25 14:30:35
本文介绍了使用WGET运行cronjob PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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

这是我使用的(crontab):

* / 5 * * * wget www.example/cronit.php

b $ 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.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 www.example/cronit.php

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

wget -O /dev/null www.example/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 www.example/cronit.php

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

更多推荐

使用WGET运行cronjob PHP

本文发布于:2023-07-16 04:09:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1117695.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:WGET   cronjob   PHP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!