Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
not sure about a command line solution - but you should be able to turn off powersaving by adding a dpms option to the monitor section of your xorg.conf –  fossfreedom Sep 17 '11 at 20:59
    
OK - it is worth adding that stuff into your question. I presume you tried the "monitor xorg trick and it didnt work"? - also add that into your question. –  fossfreedom Sep 18 '11 at 9:15
    
This works nice for me: crontab -e; */1 * * * * export DISPLAY=:0.0 && xset s 20; xset -dpms –  YumYumYum Oct 5 '11 at 13:14
add comment

5 Answers 5

up vote 7 down vote accepted
+50
#!/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.\nCheck:"
  xset -q|grep "Monitor is"
elif [ $1 = "on" ]; then
  echo -en "Turning monitor on..."
  xset dpms force on
  echo -en "done.\nCheck:"
  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

share|improve this answer
    
Still its not permanent 24/7 enabled mode? Its a KIOSK like you go to "BANK ATM machines to take money". And it becomes always BLACK screen. So people want to press a button, but they cant. Nobody wants to physically go every ATM machines to turn it on every morning. –  YumYumYum Sep 18 '11 at 8:39
    
If it has to be crontab -e? Then i can also simply do "xset dpms force on" every 0 0 0 0 0, but its completely crazy i find. Because its in the operating system somewhere, who will completely deactivate that. –  YumYumYum Sep 18 '11 at 8:43
    
I seriously do not understand why you make it so difficult!? Where in your question did you say it is a kiosk? I would suggest adding in this info in your question cuz my answer might change based on that. The script I posted works and is easy to use and understand. And no it does not have to be crontab. That is just to set the screen off when rebooting. But you can do this anywhere in the chain from booting to desktop/command line when booted. Why is it 'crazy'? I think it is normal to add something like this to cron. –  Rinzwind Sep 18 '11 at 8:51
    
Many thanks for your input (just updated my KIOSK in the question too). But about the crontab -e i thought in very begin but did not apply that, because its involving timer, using timers i am not sure 100% KIOSK will be turned on or off when the system reboot once. I want to push or tell the system. Please turn this 100% off. So that no one have to run after the 100 ATM machines to check whether or not it was off. Also i have large screens on the shop for advertising which is 24/7 slides stays running. I cant trust my linux if its not 100% turning that option off. Please advise. –  YumYumYum Sep 18 '11 at 9:05
1  
Join us in chat: chat.stackexchange.com/rooms/201/ask-ubuntu-general-room Maybe this goes quicker when talking dutch (Hoping you are not talking French ;) ) –  Rinzwind Sep 18 '11 at 9:16
add comment

This will work. Open terminal in the etc/xdg/autostart directory. Issue this command:

sudo gedit nodpms.desktop

Hit enter, you will have to input your password. Gedit will open, copy and pasted the following code in and then save.

[Desktop Entry]
Type=Application
Exec=xset -dpms
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=nodpms
Name=nodpms
Comment[en_US]=
Comment=

Issue this in the still open terminal:

sudo gedit noscreenblank.desktop

Hit enter, you will have to input your password. Gedit will open, copy and pasted the following code in and then save.

Exec=xset s off
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=noscreenblank
Name=noscreenblank
Comment[en_US]=
Comment=

Close the terminal. Open the file browser and navigate to the etc/xdg/autostart directory. Ensure that the files, nodpms.desktop and noscreenblank.desktop are there. If so, close everything and then reboot.

After reboot you can run an xset q command in terminal and see that dpms and screen blanking are turned off.

share|improve this answer
add comment

The solution to the screen blanking problem is simple once the right option is found. This has to do with power saving, but it isn't in an obvious place.

In 12.04 Gnome go to:

Applications > System tools > System Settings.

Select Brightness and Lock.

Uncheck the box for Dim screen to save power.

Next to the Turn screen off when inactive for option, select the amount of time before the screen is turned off. I selected 1 hour. Never is one selection that is available.

share|improve this answer
add comment

The previous answer will not work. If you open a terminal and issue: xset q you will see that dpms will be enabled. The easiest way I have found to solve this issue is by going into the startup applications and create 2 applications. The name you give them does not matter, the 2 commands you need are this: xset s off (this disables the screensaver) and xset -dpms (disables dpms). I wish that I new which config file to put these commands in, but I do not.

share|improve this answer
    
You may create: $ echo -e '#!/bin/bash\nsleep 50\nexport DISPLAY=:0.0\nxset s off\nxset -dpms' > /var/tmp/pp.sh; cat /var/tmp/pp.sh; contab -e /var/tmp/pp.sh –  YumYumYum Jul 25 '13 at 7:32
add comment

http://centerupt.com/sh_scripts/dpms_switch.sh

The above script will help disable dpms settings or enable settings.

Usage: dpms_switch.sh disable

This will turn off monitor power saver, etc... Hope this helps!

share|improve this answer
    
What does your script different from the one Rinzwind posted? –  guntbert Apr 8 '13 at 6:47
    
@centerupt that link is broken –  nafg Nov 27 '13 at 9:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.