Page 1 of 5 123 ... LastLast
Results 1 to 10 of 67

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

Hybrid View

  1. #1
    Join Date
    Mar 2007
    Location
    Gloucestershire, UK
    Beans
    22
    Distro
    Ubuntu 12.04 Precise Pangolin

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

    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

  2. #2
    Join Date
    Oct 2007
    Beans
    12

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

    Thanks-
    This suspend/resume seems to work better than
    Code:
    sudo /etc/acpi/sleep.sh
    on my Sony Vaio TZ170 (Hardy) - i got around the password by editing the sudoers file

    A few things I noticed however: I honestly don't know how this 'pmi action' is implemented, but could it be skipping the resume sequence in /etc/acpi/resume.d/?

    My wireless won't auto-connect on resume (no big deal really) But it's also ignoring my hdd parameters script and so is spinning the drive up/down excessively again. I may poke around /etc/hdparam.conf later

    you may want to keep an ear out for that one

  3. #3
    Join Date
    Mar 2006
    Location
    Stockholm, Sweden
    Beans
    694
    Distro
    Ubuntu Development Release

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

    Thanks man! Now I can easily put my laptop to sleep after a certain amount of time:
    Code:
    echo 'pmi action suspend' | at now + 40 minutes
    This way I can watch some Scrubs and go to bed without risking to fully drain the battery every night...

    PS I tried to officially thank you for your post but can't find that medal Thank you-button?

  4. #4
    Join Date
    Jul 2008
    Beans
    23

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

    I tried this command on my Vaio, and it worked great... about three times. Since then I get a black screen with flashing cursor.

  5. #5
    Join Date
    Feb 2005
    Location
    Geneva, Switzerland
    Beans
    976
    Distro
    Ubuntu 13.04 Raring Ringtail

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

    Quote Originally Posted by motin View Post
    I tried to officially thank you for your post but can't find that medal Thank you-button?
    The thank feature of each post is removed after 60 days (source).

  6. #6
    Join Date
    Nov 2008
    Location
    Colombia
    Beans
    13
    Distro
    Ubuntu 10.04 Lucid Lynx

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

    I found out that
    /usr/lib/hal/scripts/linux/hal-system-power-hibernate-linux
    works on my 8.04 Ubuntu.

  7. #7
    Join Date
    Jun 2008
    Beans
    20

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

    Outstanding, it's taken me days to stumble across this having made other dismal attempts to do this from the command line or via scripts - brilliant!

  8. #8
    Join Date
    May 2009
    Beans
    1

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

    I believe the proper solution is (assuming you are using gnome):

    Code:
    gnome-power-cmd suspend
    or

    Code:
    gnome-power-cmd hibernate
    This is equivalent to using the GUI.

  9. #9
    Join Date
    May 2011
    Location
    Greece,Creta
    Beans
    4

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

    Quote Originally Posted by motin View Post
    Code:
    echo 'pmi action suspend' | at now + 40 minutes
    How can actually suspend or hibernate in 40 minutes?
    Not echo it.

  10. #10
    Join Date
    Aug 2008
    Beans
    Hidden!

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

    The command shown will actually suspend in 40 minutes. echo puts the quoted text into stdout, and at reads the text piped from it - not the whole echo command, just its output.

    Why not try it?

Page 1 of 5 123 ... 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
  •