cron使用curl时的输出选项

当这样运行一个cron工作时:

curlhttp://example.com/cronjob.php

发送到邮件的输出包含以下内容:

% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 52 0 52 0 0 81 0 --:--:-- --:--:-- --:--:-- 81 0 52 0 52 0 0 31 0 --:--:-- 0:00:01 --:--:-- 0 0 98 0 98 0 0 37 0 --:--:-- 0:00:02 --:--:-- 23 0 98 0 98 0 0 27 0 --:--:-- 0:00:03 --:--:-- 15 0 98 0 98 0 0 21 0 --:--:-- 0:00:04 --:--:-- 11 100 144 0 144 0 0 25 0 --:--:-- 0:00:05 --:--:-- 18 100 144 0 144 0 0 21 0 --:--:-- 0:00:06 --:--:-- 18 100 190 0 190 0 0 23 0 --:--:-- 0:00:07 --:--:-- 17 100 190 0 190 0 0 21 0 --:--:-- 0:00:08 --:--:-- 17 100 236 0 236 0 0 24 0 --:--:-- 0:00:09 --:--:-- 27 

我发现这完全没有用,只喜欢代码输出。 有什么办法可以禁用吗?

我不明白,如果cronjob运行如下:

php /path/to/the/phpfile.php

但现在,我没有select,只能使用curl。

寻找man curl :…

  -s/--silent Silent mode. Don't show progress meter or error messages. Makes Curl mute. 

所以curl -s http://example.com/cronjob.php会做的。

您也可以使用以下选项:

  -S/--show-error When used with -s it makes curl show error message if it fails. 

希望能帮助到你。

你有没有尝试过:

  curl --silent http://example.com/cronjob.php >>/path/to/output.log 2>&1 

??