运行 top 而不是 getty

Mat*_*hid 5 startup systemd

默认情况下,在除 VT7 之外的每个 VT 上systemd自动启动getty。我想是systemd要推出top的VT6代替getty。知道我如何配置它来做到这一点吗?

tal*_*zin 4

我认为你不能这样做,tty6因为:

tty6专门为自动生成的 getty 保留,并且不可用于其他子系统,例如 X[3]。这样做是为了确保始终有办法获得文本登录,即使由于快速用户切换 X 占用了超过 5 个 VT。

欲了解更多信息,您可以查看此处

但你可以尝试一下这个tty5例子。您可以在大多数发行版中创建以下服务(testo.service 或您决定的任何服务)/lib/systemd/system/,但openSUSE我认为是/usr/lib/systemd/system

[Unit]
Description=top on tty5

[Service]
Type=simple
ExecStart=/usr/bin/top
ExecStop=/bin/kill -HUP ${MAINPID}
StandardInput=tty
StandardOutput=tty
TTYPath=/dev/tty5
Restart=always
RestartSec=2

[Install]
WantedBy=getty.target
Run Code Online (Sandbox Code Playgroud)

进而:

systemctl enable testo.service
Run Code Online (Sandbox Code Playgroud)