Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
11
rated 0 times [  11] [ 0]  / answers: 1 / hits: 32486  / 3 Years ago, sun, october 31, 2021, 12:21:05

I have tried as following:



1. Turn off: export DISPLAY=:0.0 && xset dpms force off 
2. Turn on: export DISPLAY=:0.0 && xset -dpms


Which works but that is a temporary solution, which does not fix my problem yet. When i reboot system it start again and again the same auto turn off mode.



How can i now remotely using SSH turn it off forever?



IMPORTANT:



- KIOSK (ATM machine will use this option)
- 24/7 advertising display/slides will use this


Optional Note: this guide i followed http://v2kblog.blogspot.com/2008/08/disabling-monitor-power-saver.html , but permanent solution did not worked.


More From » 11.04

 Answers
6
#!/bin/bash
export DISPLAY=:0.0

if [ $# -eq 0 ]; then
echo usage: $(basename $0) "on|off|status"
exit 1
fi

if [ $1 = "off" ]; then
echo -en "Turning monitor off..."
xset dpms force off
echo -en "done.
Check:"
xset -q|grep "Monitor is"
elif [ $1 = "on" ]; then
echo -en "Turning monitor on..."
xset dpms force on
echo -en "done.
Check:"
xset -q|grep "Monitor is"
elif [ $1 = "status" ]; then
xset -q|sed -ne 's/^[ ]*Monitor is //p'
else
echo usage: $(basename $0) "on|off|status"
fi


Save this script in something like /usr/bin, give it a name (like switch_dpms) and make it executable with chmod 664 /usr/bin/switch_dpm.



Now all you need to do is add it to a cron job. So open your crontab file with:



crontab -e


and add this at the bottom:



@reboot /usr/bin/switch_dpms off


Every reboot it will turn dpms to off and you can also turn it on from commandline by doing /usr/bin/switch_dpms on or check its status with /usr/bin/switch_dpms status.



Source for the script


[#43512] Sunday, October 31, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
smelrop

Total Points: 263
Total Questions: 122
Total Answers: 108

Location: Saudi Arabia
Member since Thu, Jan 28, 2021
3 Years ago
smelrop questions
Mon, Mar 13, 23, 07:22, 1 Year ago
Sun, Feb 5, 23, 13:02, 1 Year ago
Tue, Aug 31, 21, 00:50, 3 Years ago
Sat, Dec 18, 21, 15:18, 2 Years ago
;