服务状态命令是否持续监控状态?

服务状态命令是否持续监控状态?

当我跑步的时候

$ sudo service td-agent status
● td-agent.service - td-agent: Fluentd based data collector for Treasure Data
   Loaded: loaded (/lib/systemd/system/td-agent.service; enabled; vendor preset: enabl
   Active: active (running) since Mon 2019-04-01 04:05:36 UTC; 6min ago
     Docs: https://docs.treasuredata.com/articles/td-agent
  Process: 7570 ExecStop=/bin/kill -TERM ${MAINPID} (code=exited, status=0/SUCCESS)
  Process: 7857 ExecStart=/opt/td-agent/embedded/bin/fluentd --log /var/log/td-agent/t
 Main PID: 7875 (fluentd)
    Tasks: 24 (limit: 2362)
   CGroup: /system.slice/td-agent.service
           ├─7875 /opt/td-agent/embedded/bin/ruby /opt/td-agent/embedded/bin/fluentd -
           └─7878 /opt/td-agent/embedded/bin/ruby /opt/td-agent/embedded/bin/fluentd -

Apr 01 04:05:35 ip-10-1-88-128 systemd[1]: Starting td-agent: Fluentd based data colle
Apr 01 04:05:36 ip-10-1-88-128 systemd[1]: Started td-agent: Fluentd based data collec
lines 1-14/14 (END)

它不会再回来了,光标发出蜂鸣声作为信号,就像在不断检查状态一样。

是事实吗?

我也尝试了以下方法,但它并不像我预期的那样令人耳目一新。

watch -n 10 sudo service td-agent status

任何帮助将不胜感激 ;)

答案1

watch应与 一起使用systemctl,并启用颜色:

watch -c "sudo SYSTEMD_COLORS=1 systemctl status td-agent"

来源:https://unix.stackexchange.com/a/555179/15012

相关内容