View previous topic :: View next topic |
Author |
Message |
decuser n00b
Joined: 23 Jan 2003 Posts: 60 Location: Godley, Texas
|
Posted: Thu Jan 04, 2024 4:46 pm Post subject: Right way to set a timeout for blanking the console screen |
|
|
Who knew that there was such a thing as console codes? Anyway, after a bit of research, I found out the console can be controlled from the terminal via escape codes and that these can be automated vi /dev/console.
First, lookup the stuff I wanna do - kill the bell (immediately), blank the screen (after 5 minutes), power down the screen (after 10 minutes)
Code: | man console_codes
...
ESC [ 11 ; n ] Set bell duration in msec.
ESC [ 9 ; n ] Set screen blank timeout to n minutes.
ESC [ 14 ; n ] Set the VESA powerdown interval in minutes.
... |
Second, edit /etc/init.d/console and make it executable
Code: | vi /etc/init.d/console
# set bell duration to 0ms
echo -e "\033[11;0]" >/dev/console
# turn display off after 5 minutes
echo -e "\033[9;5]" >/dev/console
# power down display after 10 minutes
echo -e "\033[14;10]" >/dev/console
chmod a+x /etc/init.d/console |
Third, enable the service and reboot
Code: | rc-update add console default
reboot |
et voila! it works.
But, is it the "right" way to do it? You tell me. |
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3140
|
Posted: Thu Jan 04, 2024 7:08 pm Post subject: |
|
|
setterm? |
|
Back to top |
|
|
Ralphred Guru
Joined: 31 Dec 2013 Posts: 501
|
Posted: Fri Jan 05, 2024 1:16 pm Post subject: |
|
|
I use Code: | /usr/bin/setterm --term linux --blank 1 --powerdown 1 >>/dev/tty1 | in a /etc/local.d/stuff.start script.
It turns off the default console after a minute, and I can switch to tty2+ if I want to do something that I would like the monitor to stay on for. |
|
Back to top |
|
|
|