Power Saving for the Workstation, Part 2 - page 2
Automatically Suspending to RAM
Turning Suspend On, Off From the Desktop
What if you're doing a long download or any other lengthy unattended process which you do NOT want interrupted via suspend? Since the suspend sleep-detector.sh script for monitoring checks for DPMS being enabled, turning off DPMS will abort the script.
Figures 1 and 2 provide some icons for you to use. Right-click each of the icon images (48x48) and save them somewhere you can find them later.
For KDE users, right-click your desktop screen and Create New > Link to Application. On the General tab, click the icon displayed to open the Select Icon dialog box. Select the Other icons option and then Browse. Locate where you saved Figure 2 (suspend-off.png), and then click Open. Back in the General tab, enter Suspend Off in the Link to Application text box. In the Application tab, set the Command value to
Repeat the process for the Suspend On icon, only this time enter this line in the Application tab's Command field:
xset +dpms;sh /usr/local/bin/sleep-detector-1.sh
Also in the Application tab, click the Advanced Features button and enter the User value as
To start suspend-to-RAM, click the Suspend On icon. This only works from root because the actual hibernate script does a "is the user root?" check, which I haven't figured out how to bypass, and the script doesn't run stably out of rc.local. You can run it manually from a script, if you do, you can tell if it's on by:
$ ps -A
Look for sleep, sh, you might see xset.
To shut it down, click the Suspend Off icon. Root access is not required, because while
sleep-detector-1.sh runs as root,
xset does not. If you want to revert to normal operation, you have to restart DPMS before restarting the script.
On my box and configuration, suspend takes about 30 seconds, returning from suspend takes about 20 seconds.
There was an intermittent problem with this, as the desktop didn't go into screensaver sometimes and then didn't go into suspend mode. It seems to have been fixed by removing the
sh sleep-detector-1.sh command from rc.local, which is why the suspend monitor has to be started manually.
The workaround below may help you with problems that you might have that I didn't. Xterm is used here because the display might not be visible from the usual console window, and xterm works directly with X Windows.
Open an X Terminal via menu, with the Start > System > Xterm menu command. Or, from a regular terminal enter:
From within Xterm
# xset -dpms # xset +dpms # /usr/local/bin/sleep-detector-1.sh
- 1Linux Top 3: Network Security Toolkit, Untangle NG Firewall and IPFire
- 2Linux Top 3: Fedora 24, Peppermint 7 and Solus 1.2
- 3Linux Top 3: Alpine Linux 3.4, deepin 15.2 and Linux Lite 3.0
- 4Linux 4.7 Set to Boost Live Patching, Security and Power Management
- 5Linux 4.6 Charred Weasel adds USB 3.1 Support