服务
mkdir .boot-scripts/
cat < /root/.boot-scripts/screen-off.sh
!/bin/bash
setterm --blank 1
EOF
cat < /etc/systemd/system/screen-off.service
[Unit]
Description=Blank screen after 1 min and turn it off after 2 min. Any keypress will turn it back on.
After=ssh.service
[Service]
Type=oneshot
Environment=TERM=linux
StandardOutput=tty
TTYPath=/dev/console
ExecStart=/root/.boot-scripts/screen-off.sh
[Install]
WantedBy=local.target
EOF
chmod +x /root/.boot-scripts/screen-off.sh
chmod +x /etc/systemd/system/screen-off.service
systemctl enable screen-off.service
systemctl start screen-off.service
systemctl status screen-off.service