使用curl时的cron输出选项

前端之家收集整理的这篇文章主要介绍了使用curl时的cron输出选项前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在运行这样的cron作业时:

卷曲http://example.com/cronjob.php

发送到邮件输出包含:

  1. % Total % Received % Xferd Average Speed Time Time Time Current
  2. Dload Upload Total Spent Left Speed
  3.  
  4. 0 52 0 52 0 0 81 0 --:--:-- --:--:-- --:--:-- 81
  5. 0 52 0 52 0 0 31 0 --:--:-- 0:00:01 --:--:-- 0
  6. 0 98 0 98 0 0 37 0 --:--:-- 0:00:02 --:--:-- 23
  7. 0 98 0 98 0 0 27 0 --:--:-- 0:00:03 --:--:-- 15
  8. 0 98 0 98 0 0 21 0 --:--:-- 0:00:04 --:--:-- 11
  9. 100 144 0 144 0 0 25 0 --:--:-- 0:00:05 --:--:-- 18
  10. 100 144 0 144 0 0 21 0 --:--:-- 0:00:06 --:--:-- 18
  11. 100 190 0 190 0 0 23 0 --:--:-- 0:00:07 --:--:-- 17
  12. 100 190 0 190 0 0 21 0 --:--:-- 0:00:08 --:--:-- 17
  13. 100 236 0 236 0 0 24 0 --:--:-- 0:00:09 --:--:-- 27

我觉得这完全没用,而且更喜欢代码输出.有没有办法禁用它?

如果cronjob运行如下,我不会得到这个:

PHP /path/to/the/PHPfile.PHP

但是现在,我没有选择,只能使用curl.

解决方法

搜索男人卷曲:…
  1. -s/--silent
  2. Silent mode. Dont show progress meter or error messages.
  3. Makes Curl mute.

所以curl -s http://example.com/cronjob.PHP就可以了.

您可能还想使用以下选项:

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

希望能帮助到你.

猜你在找的Linux相关文章