[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: servidor em notebook e desligamento da tela



Em 06/07/2021 23:51, José Figueiredo escreveu:
Pessoal, boa noite.
Fiz um servidor, usando Debian 10 em um notebook antigo que tenho - a instalação está ultra limpa - apenas a instalação do netinstall com um acesso SSH.
A dificuldade está em que a tela fica 100% do tempo ligada, o que é inútil pois faço todo acesso remotamente. Gostaria de dicas de como desativar a tela - tipo descanso de tela em modo texto.
Não tenho servidor X instalado nessa máquina.
Estou pesquisando há alguns dias e não consegui encontrar uma solução.
Grato.
--
José de Figueiredo
Seja Livre, use GNU/Linux. Use Debian !!!
----------------------------------------------------------------
Antes de autorizar um aborto, pense que poderia ser vc lá dentro,
esperando alguém decidir se vc morre ou não...
http://www.brasilsemaborto.com.br/
----------------------------------------------------------------
Venha estudar no IFSul - é público, federal e de qualidade.

Olá!

        Não sei o que já tentou, mas há muito muito tempo atrás utilizei com sucesso o setterm.

        Pesquisei para ver se tinha algo para Debian 10, achei um bem interessante para Ubuntu de 2019, provavelmente deve rolar bem no Debian 10 e com systemd para automatizar:

Blank screen after 1 min and turn it off after 2 min. Any keypress will turn it back on. Make it auto-start after reboot.

The magic command what will do all the work:

setterm --blank 1 --powerdown 2

If you get error: setterm: terminal xterm-256color does not support --blank


Make it auto-start

Insert command in executable file. Store it for example in hidden folder of your home directory /home/USER/.boot-scripts/screen-off.sh

#!/bin/bash
setterm --blank 1 --powerdown 2

And make script file executable by systemctl. Create file /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=/home/USER/.boot-scripts/screen-off.sh

[Install]
WantedBy=local.target

Make it executable:

    sudo chmod +x /home/USER/.boot-scripts/screen-off.sh
    sudo chmod +x /etc/systemd/system/screen-off.service

And finally get it working and enabled on boot:

sudo systemctl start screen-off.service
sudo systemctl enable screen-off.service

To disable it:

sudo systemctl disable screen-off.service

answered Dec 6 '19 at 14:11
Marek Vach



-- 

[]'s

Junior Polegato

Reply to: