简体   繁体   English

crontab不运行links2命令

[英]crontab doesn't run the links2 command

I'm trying run the following command every 1 minute using crontab, but the command doesn't run. 我正在尝试使用crontab每1分钟运行以下命令,但是该命令无法运行。

1 * * * *  /usr/bin/links2 http://localhost/tomada/temperatura/servidor.php

The command works fine using the shell 使用外壳程序,该命令运行正常

What is the problem? 问题是什么?

First -- don't use links for that purpose; 首先-不要为此目的使用links it's built to be an interactive browser, but a cron job by its nature is noninteractive. 它被构建为交互式浏览器,但从本质上讲,cron作业是非交互式的。 curl is the right tool for the job: curl是完成这项工作的正确工具:

* * * * *  curl http://localhost/tomada/temperatura/servidor.php

...or, if you can't use curl (why?), then wget: ...或者,如果您不能使用curl(为什么?),则可以使用wget:

* * * * *  wget -O - http://localhost/tomada/temperatura/servidor.php

Second -- if you must use links, use it in an explicitly noninteractive way, such as with -dump or -source : 其次-如果必须使用链接,请以显式非交互方式使用它,例如-dump-source

* * * * *  /usr/bin/links2 -dump http://localhost/tomada/temperatura/servidor.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM