AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题 / 779045
Accepted
lylklb
lylklb
Asked: 2024-06-26 20:58:06 +0800 CST2024-06-26 20:58:06 +0800 CST 2024-06-26 20:58:06 +0800 CST

对部分标准输出在过渡期内重新定向的质疑

  • 772

如何保留过渡期间的完整 stdout 输出?
如下面典型的例子,你可以看到 yum 元数据刷新状态不会重定向到其 yr.log。
所以我的问题是如何在过渡期间保留这些输出。

# 
# yum  -v repolist
Not loading "rhnplugin" plugin, as it is disabled
Not loading "product-id" plugin, as it is disabled
Loading "refresh-packagekit" plugin
Loading "security" plugin
Not loading "subscription-manager" plugin, as it is disabled
Config time: 0.015
Yum Version: 3.2.29
RHEL_6.4_x86-64                                    | 3.9 kB     00:00 ... 
RHEL_6.4_zlocal                                    | 2.9 kB     00:00 ... 
Setting up Package Sacks
pkgsack time: 0.012
Repo-id      : RHEL_6.4_x86-64
Repo-name    : RHEL_6.4_x86-64_dvd_all
Repo-revision: 1359576928
Repo-updated : Thu Jan 31 04:22:56 2013
Repo-pkgs    : 3,648
Repo-size    : 3.2 G
Repo-baseurl : file:///mnt/
Repo-expire  : 21,600 second(s) (last: Wed Jun 26 08:26:11 2024)

Repo-id      : RHEL_6.4_zlocal
Repo-name    : RHEL_6.4_x86-64_dvd_zlocal
Repo-revision: 1715738735
Repo-updated : Wed Mar 31 17:26:56 2021
Repo-pkgs    : 3,720
Repo-size    : 3.2 G
Repo-baseurl : file:///install/rhel_6.4_x86_64/
Repo-expire  : 21,600 second(s) (last: Wed Jun 26 08:26:11 2024)

repolist: 7,368
# 
# 
# 
# yum -v repolist 1> /tmp/yr.log 2> /tmp/yr.err
# 
# 
# cat /tmp/yr.log
Not loading "rhnplugin" plugin, as it is disabled
Not loading "product-id" plugin, as it is disabled
Loading "refresh-packagekit" plugin
Loading "security" plugin
Not loading "subscription-manager" plugin, as it is disabled
Config time: 0.069
Yum Version: 3.2.29
Setting up Package Sacks
pkgsack time: 0.712
Repo-id      : RHEL_6.4_x86-64
Repo-name    : RHEL_6.4_x86-64_dvd_all
Repo-revision: 1359576928
Repo-updated : Thu Jan 31 04:22:56 2013
Repo-pkgs    : 3,648
Repo-size    : 3.2 G
Repo-baseurl : file:///mnt/
Repo-expire  : 21,600 second(s) (last: Wed Jun 26 15:24:26 2024)

Repo-id      : RHEL_6.4_zlocal
Repo-name    : RHEL_6.4_x86-64_dvd_zlocal
Repo-revision: 1715738735
Repo-updated : Wed May 15 10:06:56 2024
Repo-pkgs    : 3,720
Repo-size    : 3.2 G
Repo-baseurl : file:///install/rhel_6.4_x86_64/
Repo-expire  : 21,600 second(s) (last: Wed Jun 26 15:24:27 2024)

repolist: 7,368
# 
io-redirection
  • 1 1 个回答
  • 54 Views

1 个回答

  • Voted
  1. Best Answer
    lylklb
    2024-07-17T21:23:13+08:002024-07-17T21:23:13+08:00

    使用脚本-q -c函数捕获进度计日志。

    # 
    #  
    # script -q /tmp/yvr_1.out -c 'yum -v repolist' 1> /tmp/yvr_1.log 2> /tmp/yvr_1.err
    # 
    # 
    # cat /tmp/yvr_1.log
    Not loading "katello" plugin, as it is disabled
    Not loading "product-id" plugin, as it is disabled
    Not loading "rhnplugin" plugin, as it is disabled
    Loading "security" plugin
    Not loading "subscription-manager" plugin, as it is disabled
    Loading "verify" plugin
    Config time: 0.071
    Yum Version: 3.2.22
    Cluster                                                   | 1.5 kB     00:00     
    ClusterStorage                                            | 1.5 kB     00:00     
    RHEL_5.8_local                                            |  951 B     00:00     
    Server                                                    | 1.5 kB     00:00     
    VT                                                        | 1.3 kB     00:00     
    Setting up Package Sacks
    pkgsack time: 0.023
    Repo-id      : Cluster
    Repo-name    : Cluster_r58
    Repo-updated : Fri Feb  3 02:38:19 2012
    Repo-pkgs    : 32
    Repo-size    : 83 M
    Repo-baseurl : file:///mnt/Cluster/
    Repo-expire  : 3,600 second(s) (last: Mon Jul 15 16:33:35 2024)
    
    Repo-id      : ClusterStorage
    Repo-name    : ClusterStorage_r58
    Repo-updated : Fri Feb  3 02:39:28 2012
    Repo-pkgs    : 39
    Repo-size    : 11 M
    Repo-baseurl : file:///mnt/ClusterStorage/
    Repo-expire  : 3,600 second(s) (last: Mon Jul 15 16:33:35 2024)
    
    Repo-id      : RHEL_5.8_local
    Repo-name    : RHEL_5.8_x86-64_all_local
    Repo-updated : Tue Apr 23 10:43:03 2024
    Repo-pkgs    : 3,414
    Repo-size    : 3.6 G
    Repo-baseurl : file:///install/rhel_5.8_x86-64_local/
    Repo-expire  : 3,600 second(s) (last: Mon Jul 15 16:33:35 2024)
    
    Repo-id      : Server
    Repo-name    : Server_r58
    Repo-updated : Fri Feb  3 02:39:04 2012
    Repo-pkgs    : 3,285
    Repo-size    : 3.3 G
    Repo-baseurl : file:///mnt/Server/
    Repo-expire  : 3,600 second(s) (last: Mon Jul 15 16:33:35 2024)
    
    Repo-id      : VT
    Repo-name    : VT_r58
    Repo-updated : Fri Feb  3 02:38:17 2012
    Repo-pkgs    : 58
    Repo-size    : 193 M
    Repo-baseurl : file:///mnt/VT/
    Repo-expire  : 3,600 second(s) (last: Mon Jul 15 15:33:36 2024)
    
    repolist: 6,828
    # 
    # 
    
    • 1

相关问题

  • 如何将错误消息重定向到/dev/null?

  • 是否有与标准输入的 `tee` 类似的工具?

  • 使用 heredocument 重定向到 crontab

  • 如何使用 grep 将输出拆分为两个文件?

  • 如何将 airodump-ng 的输出保存到文件中?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve