You are not logged in.
Pages: 1
Topic closed
Hi
I've been trying to find a way to turn off my monitor, but the solutions I've found were almost all for X environment.
The best hint I've got was add following lines to /etc/rc.local:
setterm -blank 1
setterm -powersave on
setterm -powerdown 1
With that, monitor was suppose to blank screen after 1 minute and, after another 1 minute, shutdown. But it only blanks and nothing more. Without the first line: "setterm -blank 1", it just don't do anything.
Does anybody has idea of what else should I try?
Thanks in advance.
Last edited by vinicius (2009-02-27 02:48:43)
Offline
I like slock.
Run it, and it both locks the screen and puts the monitor to sleep. To unlock, just type your password and press enter.
Or do you mean from console, rather than a terminal?
Bob
Last edited by Hrod beraht (2009-02-24 20:11:03)
Offline
Or do you mean from console, rather than a terminal?
Hi, Bob
It's exactly that: I am using the console without a X server running.
Thanks for your reply.
P.S.: For those little confused with terminology (like me ), here is a fast explanation http://www.linuxforums.org/forum/linux- … xterm.html
Offline
This may help:
flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)
Offline
This may help:
Hi, dyscoria
In fact, when I started searching before post my question, I've found that thread you pointed and was from there that I got setterm hint.
The other suggestions there only work at X environment and I am not starting X.
Thanks for helping.
Offline
Are you trying to just turn off the monitor but have the OS running or are you trying to do suspends, hibernates and that sort of thing?
Offline
Are you trying to just turn off the monitor but have the OS running or are you trying to do suspends, hibernates and that sort of thing?
Just turn off the monitor.
Offline
Offline
I like vlock
Daenyth,
This is really useful! I didn't know vlock and I liked it very much.
Thak you.
But it doesn't turn off the monitor.
Last edited by vinicius (2009-02-26 00:04:40)
Offline
Hi, guys
I've found something interesting:
# vbetool dpms off
This command turns off the monitor regardless of X is running or not. So, this is almost the answer I'm looking for.
Now, let me explain that almost.
There are two bad points to consider about this command:
1- Only super user is able to run it. (Actually, it's not a big deal. The computer is mine - I am a super user! )
2- The only way to turn on monitor back is with
# vbetool dpms on
and (this is the boring part) monitor is still off until you finish typing that and hit <enter>.
Do you have idea of how to make monitor power on again just by pressing any key?
Vinicius
Offline
Well . It's not a perfect solution but why don't you use aliases ?
In /root/.bashrc (If you're using bash)
alias von='vbetool dpms on'
alias voff='vbetool dpms off'
Last edited by Nezmer (2009-02-26 21:28:01)
English is not my native language .
Offline
Hi, Nezmer
Even with aliases, I would have to type von with monitor turned off.
I've done a script, witch is not a perfect solution, but works fine.
monitor_off:
#!/bin/bash
###################################################
# Check if X is running or not, turn off monitor, #
# wait for a key press and turn it on again. #
###################################################
grep_result_file=$PWD'/x_running'
# Check if X is running.
ps -e | grep -e "\bX\b" > $grep_result_file
ps -e | grep -e "\bxorg\b" >> $grep_result_file
ps -e | grep -e "\bxserver\b" >> $grep_result_file
## If you want to check result file, uncomment following lines.
#echo "===== $grep_result_file - begin ====="
#cat $grep_result_file
#echo "===== $grep_result_file - end ====="
if [ ! -s $grep_result_file ] || [[ $(tty) =~ tty ]] || [[ $(tty) =~ vc ]]; then
echo 'Detected X not runnig or you are at console...'
if [ $UID -ne 0 ]; then
echo 'You need super user privileges to run this script at console.'
echo 'Rerun as super user or start X and run from a terminal.'
exit 0
fi
turn_off='vbetool dpms off'
turn_on='vbetool dpms on'
else
echo 'Detected X running...'
turn_off='xset dpms force off'
fi
echo 'Turning off monitor...'
$turn_off
echo 'Waiting for a key press...'
read -n1 -s
echo 'Turning on monitor...'
$turn_on
rm $grep_result_file
echo 'Finished: monitor_off'
It checks if X is running or not because at X environment vbetool was a little slow, at least for me.
That's it!
I hope this could be useful for someone else.
Thank you for helping, guys.
Vinícius
P.S.: I'm setting this thread as solved, but any suggestion about the script is welcome.
Offline
Thanks vinicius i was looking for something to turn off my laptop (that now acts as a home server) from ssh to save some power and vbetool is perfect
Offline
Thanks. It was just what i were looking for. Using it on a small netbook running smeserver, but wouldn't let others have easy access as root.
If the you add the line "kill -9 $PPID" as last line. The script will logout of the shell, and show the login message. No root access ;-)
Offline
Thanks.vbetool is what i need.
#visudo
add this line: username ALL=NOPASSWD:/usr/sbin/vbetool ,so no need password.
and i assign a key to turn off ,another to turn on in openbox rc.xml,it's done ^_^
Offline
Please don't necro-bump old threads..
Closing...
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
Pages: 1
Topic closed