Page 7 of 7 FirstFirst ... 567
Results 61 to 67 of 67

Thread: [SOLVED] HowTo sleep / standby / hibernate / suspend from command line

  1. #61
    Join Date
    Jan 2010
    Beans
    34

    Re: [SOLVED] HowTo sleep / standby / hibernate / suspend from command line

    Quote Originally Posted by Rebelli0us View Post
    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"

  2. #62
    Rebelli0us is offline Extra Foam Sugar Free Ubuntu
    Join Date
    Feb 2008
    Beans
    722

    Re: [SOLVED] HowTo sleep / standby / hibernate / suspend from command line

    Quote Originally Posted by Artif View Post
    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?

  3. #63
    Join Date
    Jan 2010
    Beans
    34

    Re: [SOLVED] HowTo sleep / standby / hibernate / suspend from command line

    Quote Originally Posted by Rebelli0us View Post
    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...)

  4. #64
    Rebelli0us is offline Extra Foam Sugar Free Ubuntu
    Join Date
    Feb 2008
    Beans
    722

    Re: [SOLVED] HowTo sleep / standby / hibernate / suspend from command line

    Quote Originally Posted by Artif View Post
    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...)
    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.

  5. #65
    Join Date
    Aug 2007
    Beans
    3
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: [SOLVED] HowTo sleep / standby / hibernate / suspend from command line

    Quote Originally Posted by aoakley View Post
    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):

    Code:
    pmi action suspend
    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:

    Code:
    off 50
    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!

  6. #66
    Join Date
    Feb 2012
    Location
    Los Angeles, CA
    Beans
    138
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: [SOLVED] HowTo sleep / standby / hibernate / suspend from command line

    Quote Originally Posted by aoakley View Post
    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):

    Code:
    pmi action suspend
    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.


    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?

  7. #67
    Join Date
    Jun 2009
    Location
    0:0:0:0:0:0:0:1
    Beans
    5,169
    Distro
    Kubuntu

    Re: [SOLVED] HowTo sleep / standby / hibernate / suspend from command line

    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
    Laptop: ASUS A54C-NB91 (Storage: WD3200BEKT + MKNSSDCR60GB-DX); Desktop: Custom Build - Images included; rPi Server
    Putting your Networked Printer's scanner software to shame PHP Scanner Server
    I frequently edit my post when I have the last post

Page 7 of 7 FirstFirst ... 567

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •