Re: servidor em notebook e desligamento da tela

Linux - Junior Polegato <[email protected]>
Newsgroups gmane.linux.debian.user.portuguese
Message-ID <[email protected]>
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/ <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

  * You are probably trying this command by SSH. You must run it from
    local of your machine, or do next stage of this guide.

------------------------------------------------------------------------


    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
<https://askubuntu.com/users/1022682/marek-vach>
Marek Vach <https://askubuntu.com/users/1022682/marek-vach>



-- 

[]'s

Junior Polegato
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.