如何从终端在桌面启动应用程序时禁用日志

如何从终端在桌面启动应用程序时禁用日志

我需要在其他显示器上从脚本终端打开 Chromium 中的新选项卡。当我打开时,我的终端会从 Xorg 或 GTK 接收日志(我不知道是谁打印的)。我使用了以下命令:

DISPLAY=:0 chromium-browser &

好的!此命令可以正常打开 Chromium,但我的脚本仍处于锁定状态,因为日志已发送到我的终端,如下所示:

 --disable-quic --enable-tcp-fast-open --disable-gpu-compositing --ppapi-flash-path=/usr/lib/chromium-browser/libpepflashplayer.so --ppapi-flash-args=enable_stagevideo_auto=0 --ppapi-flash-version=
Fontconfig warning: "/etc/fonts/fonts.conf", line 160: blank doesn't take any effect anymore. please remove it from your fonts.conf
[6423:6423:0426/131721.287597:ERROR:gpu_process_transport_factory.cc(1029)] Lost UI shared context.
[6423:6464:0426/131721.607400:ERROR:data_store_impl.cc(130)] Failed to open Data Reduction Proxy DB: 3
[6423:6529:0426/131721.614429:ERROR:object_proxy.cc(626)] Failed to call method: org.freedesktop.Notifications.GetCapabilities: object_path= /org/freedesktop/Notifications: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Notifications was not provided by any .service files
ATTENTION: default value of option force_s3tc_enable overridden by environment.
[6541:6541:0426/131723.171003:ERROR:sandbox_linux.cc(375)] InitializeSandbox() called with multiple threads in process gpu-process.
[6423:6423:0426/131723.532741:ERROR:CONSOLE(14)] "Uncaught TypeError: Cannot read property 'W' of null", source: https://www.google.com/_/chrome/newtab?ie=UTF-8 (14)
[6423:6477:0426/131723.719742:ERROR:upload_data_presenter.cc(73)] Not implemented reached in virtual void extensions::RawDataPresenter::FeedNext(const net::UploadElementReader &)
[6423:6477:0426/131723.775816:ERROR:upload_data_presenter.cc(73)] Not implemented reached in virtual void extensions::RawDataPresenter::FeedNext(const net::UploadElementReader &)
[6423:6477:0426/131724.152088:ERROR:upload_data_presenter.cc(73)] Not implemented reached in virtual void extensions::RawDataPresenter::FeedNext(const net::UploadElementReader &)

此行为在其他应用程序中也会发生,例如lxpanel

请问,如何禁用此日志或在其他显示器上打开任何应用程序而不使用日志。

答案1

像这样重定向所有输出:1>/dev/null 2>&1,例如:

DISPLAY=:0 chromium-browser 1>/dev/null 2>&1 &

这会将标准输出重定向至黑洞(/dev/null),并将错误输出(2)重定向至标准输出(1),因此它也会消失在“/dev/null”中。

相关内容