Home | Hardware | Internet News |Web Hosting |IT Management |Network Storage
LinuxPlanet
Search 
  Power Search | Tips 

 Front Door
 Discussion
 LinuxEngine
 Opinions
 Reports
 Reviews
 Tutorials
 News
 Technology Jobs

 Browse by subject.
Free Newsletter

Java/Open Source Daily
Linux Today
More Free Newsletters

Be a Commerce Partner


















internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

Print this article
Email this article

   LinuxPlanet / Tutorials







Power Saving for the Workstation, Part 2
Automatically Suspending to RAM

A. Lizard
Tuesday, July 31, 2007 08:42:48 PM

In part 1, you were shown how to set up hibernate and modify the configuration scripts to make it possible to suspend your desktop to RAM. In part 2, you'll step through how to implement your changes.

In the KDE Control Center, drill down through Peripherals, Display, to the Power Saving tab. Check the Enable Power Saving checkbox and set time for "Switch Off Monitor." In a non-KDE environment, find "Display Power Management." That's what automatically turns off DPMS when the system is idling.

When your monitor is shut off via DPMS by whatever method, your computer will go into suspend if you install this script:

sleep-detector-1.sh

#!/bin/bash
# put this in /usr/local/bin/sleep-detector-1.sh
# put sh /usr/local/bin/sleep-detector.sh
# default display on current host
# moved xset +dpms to icon
# try to make sure that monitor sessions don't multiply indefinitely
# note: the echo statements are for debugging when running in a terminal.
# the touch statements are also for debug. 
until [ "$STATUS" == "DPMS is Disabled" ]; do
DISPLAY=:0.0

STATUS=`xset -display $DISPLAY -q | grep -o 'DPMS is Disabled'`
if [ "$STATUS" == "DPMS is Disabled" ]
then 
echo "end suspend monitor loop - DPMS Disabled"
touch /home/username/suspend/dpms-disabled
exit 
fi

STATUS=`xset -display $DISPLAY -q | grep -o 'DPMS is Enabled'`
if [ "$STATUS" == "DPMS is Enabled" ]
then echo "SUSPEND script - DPMS working - continue monitoring" 
touch /home/username/suspend/dpms-enabled
fi

STATUS=`xset -display $DISPLAY -q | grep -o 'Monitor is On'`
if [ "$STATUS" == "Monitor is On" ]
then echo "Monitor is On - script"
touch /home/username/suspend/monitor-is-on
fi

STATUS=`xset -display $DISPLAY -q | grep -o 'Monitor is Off'`
if [ "$STATUS" == "Monitor is Off" ]
then touch /home/username/suspend/monitor-is-off
echo "Monitor is Off - script"
hibernate-ram --force
echo "hibernate-ram terminated"
fi

STATUS=`xset -display $DISPLAY -q | grep -o 'Monitor is in Suspend'`
if [ "$STATUS" == "Monitor is in Suspend" ]
then echo "Monitor is in Suspend - script"
touch /home/username/suspend/monitor-is-suspend
hibernate-ram --force
fi

STATUS=`xset -display $DISPLAY -q | grep -o 'Monitor is in Standby'`
if [ "$STATUS" == "Monitor is in Standby" ]
then echo "Monitor is in Standby-script"
touch /home/username/suspend/monitor-is-standby
hibernate-ram --force
fi
sleep 30
done
exit

The touch statements are there for diagnostic purposes, they aren't necessary to the normal operation of the script, but the touch statements will tell you where the script crashed by simply checking to see what is in /home/username/suspend. Clear the directory before running the script if you're debugging.

Next: Turning Suspend On, Off From the Desktop »

Skip Ahead

1 Automatically Suspending to RAM
2 Turning Suspend On, Off From the Desktop
3 Do You Have a UPS?
4 Alternate Suspend Methods
5 Unsolved Problems





Linux is a trademark of Linus Torvalds.


internet.com home | search | help! | about us

Jupiter Online Media

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers