要在 CentOS 上设置 cmatrix 自动启动,您需要将其添加到系统的启动脚本中。这里有一个简单的方法,使用 Systemd 创建一个新的服务单元文件。
sudo yum install cmatrix cmatrix.service 的新文件:sudo vim /etc/systemd/system/cmatrix.service cmatrix.service 文件中:[Unit] Description=cmatrix terminal multiplexer After=network.target [Service] Type=simple ExecStart=/usr/bin/cmatrix -b Restart=on-failure [Install] WantedBy=multi-user.target 这将创建一个名为 cmatrix 的 Systemd 服务,它在网络启动后运行,并在失败时自动重启。
保存并关闭文件。
重新加载 Systemd 配置以识别新创建的服务:
sudo systemctl daemon-reload sudo systemctl enable cmatrix.service sudo systemctl start cmatrix.service sudo systemctl status cmatrix.service 现在,cmatrix 应该会在每次系统启动时自动运行。如果您想要停止或禁用此服务,可以使用以下命令:
sudo systemctl stop cmatrix.service sudo systemctl disable cmatrix.service