海康智存 R1 安装 飞牛FnOS后 在小屏幕 显示CPU,内存,硬盘,网络。工具用nmon 并开机启动
傻瓜式操作,只需要飞牛内安装gotty,登陆并sudo -i 复制回车即可
1. 刷新源并安装依赖(分步执行,每步确认结果)
|
1 2 |
# 安装/升级expect / nmon apt update -y && apt install -y expect nmon |
2. 创建 nmon 自动运行脚本
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# 先创建脚本文件 cat > /usr/local/bin/nmon-tty1.sh << 'EOF' #!/usr/bin/expect -f spawn nmon sleep 2 send "c\r" sleep 1 send "m\r" sleep 1 send "n\r" sleep 1 send "t\r" interact EOF # 赋权 chmod +x /usr/local/bin/nmon-tty1.sh |
3. 创建 systemd 服务文件
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# 创建服务文件 cat > /etc/systemd/system/nmon-tty1.service << 'EOF' [Unit] Description=NMON Monitor on tty1 After=multi-user.target systemd-logind.service Conflicts=getty@tty1.service Before=getty@tty1.service [Service] ExecStart=/usr/local/bin/nmon-tty1.sh Restart=always RestartSec=3 User=root TTYPath=/dev/tty1 StandardInput=tty StandardOutput=tty KillMode=process [Install] WantedBy=multi-user.target EOF |
4. 激活服务(关键步骤拆分,每步有明确反馈)
|
1 2 3 4 5 6 7 8 |
# 刷新systemd配置 systemctl daemon-reload # 禁用冲突的tty1默认登录服务 systemctl disable --now getty@tty1.service # 启用并立即启动nmon服务 systemctl enable --now nmon-tty1.service |
|
1 |
reboot |
发表回复