Re: [SOLVED] HowTo sleep / standby / hibernate / suspend from command line
Quote:
Originally Posted by
Rebelli0us
I tried
Code:
ssh user-name@192.168.1.102 sudo pm-suspend
but it didn't work. Any ideas how to suspend machines on the network?
Did it ever worked directly on the machine? If not - try other ways to suspend.
I'm not shure you must not use double qoutes for command string, if there are internal field separators in the string:
ssh user-name@host.name "command argument argument"
Re: [SOLVED] HowTo sleep / standby / hibernate / suspend from command line
Quote:
Originally Posted by
Artif
Did it ever worked directly on the machine? If not - try other ways to suspend.
I'm not shure you must not use double qoutes for command string, if there are internal field separators in the string:
ssh
user-name@host.name "command argument argument"
Yeah machines suspend just fine, I just want to be able to do it remotely. Do you have a command that works?
Re: [SOLVED] HowTo sleep / standby / hibernate / suspend from command line
Quote:
Originally Posted by
Rebelli0us
Yeah machines suspend just fine, I just want to be able to do it remotely. Do you have a command that works?
Yes I have it. This is exact duplicate of mentioned above DBus way command ( http://ubuntuforums.org/showpost.php...7&postcount=57 ).
Code:
ssh user-name@host.name "dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend"
But you neeed to set up permissions. Into your file
"/usr/share/polkit-1/actions/org.freedesktop.upower.policy"
into section "defaults" you may insert
Code:
<allow_any>yes</allow_any>
Ubuntu 12.04 Precise will suspend.
See:
*) http://crunchbanglinux.org/forums/to...d-not-working/ (Ubuntu based light weight distro)
*) http://archive.linuxfromscratch.org/...ry/068221.html (from scratch...)
Re: [SOLVED] HowTo sleep / standby / hibernate / suspend from command line
Quote:
Originally Posted by
Artif
Thank you. I'm still trying to understand this.
Has to be installed on all machines?
Code:
sudo apt-get install policykit-1 upower acpi-support
There isn't a GUI for policy kit? Instead you edit manually?
Code:
sudo gedit /usr/share/polkit-1/actions/org.freedesktop.upower.policy
You set policy on receiving or sending machine?
What if it's a Windows machine? For Windows machines on the network, Sysinternals\PsTools\psshutdown.exe works very well but it has to be sent by another windows machine, even a VM.
Re: [SOLVED] HowTo sleep / standby / hibernate / suspend from command line
Quote:
Originally Posted by
aoakley
There are several threads which unsuccessfully seek a command line method to hibernate or suspend in Ubuntu, WITHOUT requiring root or sudo access. After a bit of digging, I've come up with the answer.
This is tested on Ubuntu 8.04 (Hardy) with a Dell Inspiron 1520 laptop. I would appreciate feedback from users of other systems.
To suspend-to-RAM (aka sleep):
To suspend-to-disk (aka hibernate):
Code:
pmi action hibernate
If you want to lock the Gnome session first (ie. require a password on resumption), then issue the following command before pmi:
Code:
gnome-screensaver-command --lock
For example, you can use these commands to create a button (launcher) on a Gnome panel (taskbar) that instantly locks the screen and goes into sleep mode:
Right-click panel, Add to panel, Custom application launcher, Add, Name: Sleep , Command: gnome-screensaver-command --lock ; pmi action suspend
Good work - you provided a piece of the puzzle for me, and it work's nicely!
I have this in my ~/.bashrc:
Code:
# Monitor off and sleep in $1 minutes
off () {
xset dpms force off && echo 'gnome-screensaver-command --lock; sudo pmi action suspend' | at now + $1 minutes
}
This switches off the monitor immediately and waits the specified number of minutes before sleeping the system. Great if you listen to stuff before sleeping! e.g. I'm listening to a podcast I know will finish in 47 minutes, so I just issue:
For this to work, I had to edit /etc/sudoers to enable sudo pmi without a password:
Code:
$USER ALL=NOPASSWD: /usr/sbin/pmi
Thanks again!
Re: [SOLVED] HowTo sleep / standby / hibernate / suspend from command line
Quote:
Originally Posted by
aoakley
There are several threads which unsuccessfully seek a command line method to hibernate or suspend in Ubuntu, WITHOUT requiring root or sudo access. After a bit of digging, I've come up with the answer.
This is tested on Ubuntu 8.04 (Hardy) with a Dell Inspiron 1520 laptop. I would appreciate feedback from users of other systems.
To suspend-to-RAM (aka sleep):
To suspend-to-disk (aka hibernate):
Code:
pmi action hibernate
I tried the sleep command but I got the error message...
Code:
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Hal was not provided by any .service files
I would love to use this command, but it's not working.
Quote:
For example, you can use these commands to create a button (launcher) on a Gnome panel (taskbar) that instantly locks the screen and goes into sleep mode:
Right-click panel, Add to panel, Custom application launcher, Add, Name: Sleep , Command: gnome-screensaver-command --lock ; pmi action suspend
How do I do this on Ubuntu 12.04?
Re: [SOLVED] HowTo sleep / standby / hibernate / suspend from command line
Quote:
I would love to use this command, but it's not working.
look at post #63
Code:
dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend