收银机安装飞牛NAS自动息屏方案
现在都2025年了,飞牛NAS都免费了,为了能顺利装上这套NAS系统,我索性就把店铺给转让了,只留下这台J1900的收银机。
装上飞牛后一直不自动关屏,导致月底电费差点让我差点要去被别人包养!
来,直入主题吧!
1、创建 /etc/rc.local 文件
使用以下命令创建文件并编辑内容:
sudo vim /etc/rc.local
内容如下(注意修正原文中的中文逗号为英文逗号)
#!/bin/sh -e#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# 关闭显示器(1分钟后空白屏幕并进入省电模式)
setterm -blank 1 -powersave powerdown -powerdown 1exit 0
2、赋予可执行权限
sudo chmod +x /etc/rc.local
3、创建 systemd 符号链接
sudo ln -s /lib/systemd/system/rc.local.service /etc/systemd/system/
4、启用并启动服务
sudo systemctl enable rc.local
sudo systemctl start rc.local.service
5、重启服务器验证
sudo reboot
到了这一步不出意外的话,你机子会自动重启了!
关于报错解决方案
部分机子在第4步会报错如下:
Failed to enable unit: Refusing to operate on alias name or linked unit file: rc.local.service
这个错误表明 systemctl 拒绝操作一个别名(alias)或链接的单元文件。在 Debian 系统中,rc.local 功能通常由 rc-local.service 提供,而不是直接通过 rc.local.service。
以下是正确的解决方法:
1. 检查并启用正确的服务名
Debian 10 的 rc.local 功能由 rc-local.service 管理,而不是 rc.local.service。运行以下命令:
sudo systemctl enable rc-local
sudo systemctl start rc-local.service
5、再次重启服务器
sudo reboot
不出意外的话,开机一分钟后就息屏了!要讲武德,给我点赞!