运行 systemctl status 或 service status 后如何不等待输入 / 输出。 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
jmyz0455
V2EX    Linux

运行 systemctl status 或 service status 后如何不等待输入 / 输出。

  •  
  •   jmyz0455 2020-04-05 09:38:31 +08:00 3567 次点击
    这是一个创建于 2098 天前的主题,其中的信息可能已经有所发展或是发生改变。

    在使用 sudo systemctl status ***sudo service *** status 这样的命令时,打印出来的通常都会处于等待输入或输出的状态,类似这样:

    ● nginx.service - The NGINX HTTP and reverse proxy server Loaded: loaded (/etc/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2020-03-31 18:38:55 CST; 4 days ago Main PID: 23306 (nginx) Tasks: 4 (limit: 1078) Memory: 11.3M CGroup: /system.slice/nginx.service ├─23306 nginx: master process /etc/nginx/sbin/nginx -c /etc/nginx/conf/nginx.conf ├─23307 nginx: worker process ├─23308 nginx: worker process └─23309 nginx: worker process Mar 31 18:38:55 vps systemd[1]: Starting The NGINX HTTP and reverse proxy server... Mar 31 18:38:55 vps nginx[23304]: nginx: the configuration file /etc/nginx/conf/nginx.conf syntax i Mar 31 18:38:55 vps nginx[23304]: nginx: configuration file /etc/nginx/conf/nginx.conf test is succ Mar 31 18:38:55 vps systemd[1]: nginx.service: Failed to parse PID from file /etc/nginx/logs/nginx. Mar 31 18:38:55 vps systemd[1]: Started The NGINX HTTP and reverse proxy server. 

    然后终端一直在等待输出的状态(不知道怎么形容),需要按 q 才能退出(也不知道怎么形容普通的模式叫啥,有没有老铁科普下?),我的系统是 Ubuntu 19.10 。

    请问有能一次输出不需要按任何键才能退出的方法吗?看过 help 貌似没有一次性输出这种参数。

    4 条回复    2020-04-05 17:02:12 +08:00
    darrh00
        1
    darrh00  
       2020-04-05 09:48:16 +08:00
    --no-pager
    Do not pipe output into a pager.
    jmyz0455
        2
    jmyz0455  
    OP
       2020-04-05 09:57:21 +08:00
    @darrh00 感谢
    julyclyde
        3
    julyclyde  
       2020-04-05 16:23:54 +08:00
    @darrh00 请教,是什么设置使它进入了 pager 状态,以至于需要用 no pager 来抑制呢?
    darrh00
        4
    darrh00  
       2020-04-05 17:02:12 +08:00
    @julyclyde

    手册里都有写,设置 SYSTEMD_PAGER=cat 和使用--no-pager 的效果是一样的。
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     905 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 23ms UTC 18:38 PVG 02:38 LAX 10:38 JFK 13:38
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86