Suspend from a remote connection ?

I have a 11.3/KDE4.5.2 desktop that I plan to use as a media server, connected to an HDTV/HDMI display and receiver(for audio).

I frequently connect to it from another PC (also 11.3/KDE4.52) using any of the following:ssh for a CLI session
XWindows application on a Windows machine
[LEFT]I have suspend up and running (suspend to ram) but I am only able to initiate it from the local console.

Is there a way to enable Suspend via any (or all) of the above remote connections?

If it matters, I wake the machine via WOL command from my router (DD-WRT), works fine.


How did you suspend it from the console? I mean, what command do you use?

Try this with ssh. It will ask you for your root password:

su -c 'pm-suspend'

Thanks for the input; I have been busy (creating and) solving other issues.

None of my Linux machines seem to be on the s2ram whitelist, so I add the following configuration file

cat /etc/pm/config.d/suspend_tweaks
# read the s2ram and pm-utils items on SuSE
#HIBERNATE_METHOD={userspace,kernel} # selects the suspend to disk method. Defaults to userspace.
S2RAM_OPTS="-f -a3" # options that are passed to s2ram. See the Suspend to RAM page for more information.

With that in place, from the system console(GUI) I can sleep from the shutdown-sleep icons or I can open a shell, su to root and execute pm-suspend.

I did check and yes, from a remote ssh connection, I can su to root and successfully execute pm-suspend as well.

Since I am most often logged in to a GUI screen from a remote Xserver, I built an item for my desktop folder to make the process more GUI friendly

cat ~/Desktop/cjmsuspendsu.desktop

#!/usr/bin/env xdg-open
[Desktop Entry]

I hacked this together from one of the konsole-su files in /usr/share/applications.

When I am logged in as my normal user, selecting the icon in the desktop folder prompts me for the root password then executes and sleeps - just what I was looking for.

This sort of hangs my remote XServer application, but I can deal with that.

Does anyone know of a definitive reference on how to build a proper application.desktop file?
I could not find much, other than suggestions to hack as I did.

On 2010-10-27 13:36, ah7013 wrote:
> Try this with ssh. It will ask you for your root password:
> Code:
> --------------------
> su -c ‘pm-suspend’
> --------------------

And powersave -u to suspend to ram (or -U to disk), as user.

It is possible to issue the command and close the connection before it
starts, by using the command “at now + 1 minute”. But then, you will not
learn if it worked, unless youuse something like “ping” to it.

Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)