Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Right way to set a timeout for blanking the console screen
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
decuser
n00b
n00b


Joined: 23 Jan 2003
Posts: 60
Location: Godley, Texas

PostPosted: Thu Jan 04, 2024 4:46 pm    Post subject: Right way to set a timeout for blanking the console screen Reply with quote

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
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3140

PostPosted: Thu Jan 04, 2024 7:08 pm    Post subject: Reply with quote

setterm?
Back to top
View user's profile Send private message
Ralphred
Guru
Guru


Joined: 31 Dec 2013
Posts: 501

PostPosted: Fri Jan 05, 2024 1:16 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum