Page 3 of 7 FirstFirst 12345 ... LastLast
Results 21 to 30 of 67

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

  1. #21
    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 nothingspecial View Post
    Just make one. Although it`s not there by default, it`s in your path by default, even if it`s not there.

    Or it always used to be, using Hardy so things might have changed.

    Edit -

    Rereading that, it doesn`t sound very clear unless you understand paths. If a directory is in your path then you can execute any binary in that directory typing the name of the program.

    To see what I mean, try typing
    Code:
    ls /usr/bin/
    One of the first programs you`ll see is the very commonly used apt-get. I`m guessing you type
    Code:
     sudo apt-get install blah blah blah
    all the time.

    If /usr/bin was not in your path you would have to type
    Code:
    sudo /usr/bin/apt-get install blah blah blah
    because bash would not search /usr/bin to find it.

    Other distros include ~/bin as a default directory, Ubuntu does not, but it does include ~/bin in your default path. So you can create ~/bin and bash will search it

    To see which directories are in your path type
    Code:
    echo $PATH
    Edit 2 -

    I`m not sure that made it clearer, anyway, research your path if your interested


    Thank you. If path works the same as in windows then I do understand it, that’s why I tried to drag the “batch” file into the BIN directory. But as I’ve mentioned, batch isn’t not running! Thanks for explaining anyway for the benefit of other new users, who I’m sure are googling on how to make Suspend work.

    My original question above was about the "Suspend" command in Keyboard Shortcuts NOT working. It only blanks the screen momentarily. So I thought of finding the suspend command and assign a keyb shortcut to it. But as you’re witnessing that’s not working either.



    //

  2. #22
    Join Date
    Oct 2009
    Beans
    2

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

    I know this thread is [solved] but I thought I could add some clarifications. I had the same problem/question about creating suspend and hibernate keyboard shortcuts.
    The script works (thanks, AgenT!). The only thing is that ~/bin is not in your paths by default on ubuntu 9.10, so you can either create the script in one of your paths (you can find them with the command "echo $PATH" as AgenT mentionned) like /usr/bin. To do that, you'll need administrator rights so in a terminal type:
    Code:
    sudo gedit /usr/bin/gnome-power-control
    Then you copy-paste the script and save.
    Then you still need the admin rights to add the execute permession so in a terminal type:
    Code:
    sudo chmod a+x /usr/bin/gnome-power-control
    Then the commands "gnome-power-control suspend" and "gnome-power-control hibernate" work, you can create keyboard shortcuts with them.
    An other way would be to create the file in any directory and point there with you command. For instance, if you create it on your desktop the command will be "/home/YOURUSERNAME/Desktop/gnome-power-control suspend"
    Cheers!

  3. #23
    Join Date
    Jan 2008
    Location
    Manchester UK
    Beans
    13,573
    Distro
    Ubuntu

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

    Quote Originally Posted by victorfb View Post
    The only thing is that ~/bin is not in your paths by default on ubuntu 9.10,
    I hate the way they keep changing things

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

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

    Thank you, it's working now... almost

    For now, I'm running it from the desktop by calling the full path. It turns out the $PATH command is CASE SENSITIVE ... %@!^&* and the delimiter is : instead of ; ..lol

    /usr/bin IS in path but ONLY some guy named "root" is allowed to do it, ... I figured out how to login as root, how do I make that the default in the login screen?

    Under keyboard shortcuts, can I just put the line from the script?

    dbus-send --print-reply \
    --system \
    --dest=org.freedesktop.DeviceKit.Power \
    /org/freedesktop/DeviceKit/Power \
    org.freedesktop.DeviceKit.Power.Suspend


    All in one line, I assume the \ is a line break?


    Last question and most important: When I suspend this way there's NO prompt for password when I wake the machine. Whereas when I suspend from the Shutdown dialog or the Sleep key I get the normal pw login. How does one enable the password prompt for this command?




    //
    Last edited by Rebelli0us; November 27th, 2009 at 04:34 PM.

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

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

    Ok I tried it. If you just want a Suspend command, you don't need to call the batch file or script. Just create a new Keyboard Shortcut with this command in one line:

    dbus-send --print-reply --system --dest=org.freedesktop.DeviceKit.Power /org/freedesktop/DeviceKit/Power org.freedesktop.DeviceKit.Power.Suspend



    As I mentioned above, with this method, there is still NO prompt for password on Resume, that needs fixing.

    The reason I'm here, is because the built-in “Suspend” command doesn't work, so that needs fixing too.

  6. #26
    Join Date
    Mar 2007
    Beans
    70
    Distro
    Ubuntu 10.04 Lucid Lynx

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

    Is this really solved??

    I have pmi installed, but pmi action suspend does nothing. (none of the pmi commands do.) The "sudo /etc/acpi/sleep.sh sleep" does.

    However, it is well and good for me to force the computer to sleep, but how can I get it to do it on its own? After 30 minutes of doing nothing, the way my Windows XP does?

    I want my ubuntu server to sleep during the night (after some idle time) and then wakeup-on-lan when I try to use it over the internet (send a WOL packet first).

  7. #27
    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 grandsatrap View Post
    Is this really solved??

    I have pmi installed, but pmi action suspend does nothing. (none of the pmi commands do.) The "sudo /etc/acpi/sleep.sh sleep" does.

    However, it is well and good for me to force the computer to sleep, but how can I get it to do it on its own? After 30 minutes of doing nothing, the way my Windows XP does?

    I want my ubuntu server to sleep during the night (after some idle time) and then wakeup-on-lan when I try to use it over the internet (send a WOL packet first).
    Auto-suspend works on my machine, screen timeout also... it's in the POwer options.

    Have you tried the Suspend command on my last post above?

    In windows I can wake up machines on my home network via magic packet, and also suspend them with utility from Sysinternals, but I haven't tried it in Linux cos LAN configuration seems more technical.

  8. #28
    Join Date
    Jan 2009
    Location
    Kombai,Theni dt,Tamil Nad
    Beans
    153
    Distro
    Ubuntu 10.04 Lucid Lynx

    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
    Wonderful,thank you so much for your help
    Give the world the BEST you've got
    The BEST will come back to you
    _____________________________________
    Core i7 860 2.80GHz,4 GB RAM,Gigabyte P55M-UD2,MSI N9800GT mo1G

  9. #29
    Join Date
    Dec 2009
    Location
    New York
    Beans
    41
    Distro
    Ubuntu 10.10 Maverick Meerkat

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

    These commands have worked the most reliably for me:
    Code:
    sudo s2ram
    sudo s2disk
    sudo s2both
    Which are suspend-to-RAM (standby/suspend), suspend-to-disk (hibernate), and "hybrid", like the hybrid sleep feature of win7.

  10. #30
    Join Date
    Dec 2009
    Beans
    50

    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
    Great! I have been looking for this. Works on my gigabyte 912 tablet pc.

Page 3 of 7 FirstFirst 12345 ... LastLast

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
  •