加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

使用curl时的cron输出选项

发布时间:2020-12-13 17:20:00 所属栏目:Linux 来源:网络整理
导读:在运行这样的cron作业时: 卷曲http://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
在运行这样的cron作业时:

卷曲http://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

但是现在,我没有选择,只能使用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.

希望能帮助到你.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读