Page 1 of 1

[HOWTO] Suspend or "sleep" a PC

Posted: Tue 02 Jan 2018, 03:43
by frenchiveruti
So, many of the users of puppy linux, use puppy for laptops, those are great suspending because the acpi can read the battery and actually work.
But for PC users like me, the solution is just this command line:

Code: Select all

echo -n mem > /sys/power/state
And that's it!
Why that works? Here's the answer:
https://www.kernel.org/doc/Documentatio ... states.txt

I hope this helps!

Credits to the solution where they should be:
http://www.murga-linux.com/puppy/viewto ... 802#725802

Posted: Sat 06 Jan 2018, 00:33
by Mike Walsh
@frenchiveruti:-

Sounds easy enough. Just one question, though; how do you 'wake' it up again? Is it as simple as pressing the power-on button?

Just curious, really. I know with a laptop you'd simply open the lid (I think). Or is that the 'sleep' option?

I get muddled up with the two of them, I confess..! :roll:


Mike. :wink:

Posted: Sat 06 Jan 2018, 02:30
by slavvo67
This works for me. Just move the mouse or touch the keyboard to wake it up.

Code: Select all

sleep 1 && xset dpms force off
BTW, not my own. Someone provided this a while back. I just script it to root/my-applications/bin , make it executable and drag a copy to the desktop. One click and boom....

Posted: Sat 06 Jan 2018, 03:02
by nic007
slavvo67 wrote:This works for me. Just move the mouse or touch the keyboard to wake it up.

sleep 1 && xset dpms force off


BTW, not my own. Someone provided this a while back. I just script it to root/my-applications/bin , make it executable and drag a copy to the desktop. One click and boom....
That command only influences the screen as far as I know and does not put your whole system to sleep (standby). To awake from system standby, you need to press the power button.

Posted: Sat 13 Jan 2018, 22:52
by frenchiveruti
Mike Walsh wrote:@frenchiveruti:-

Sounds easy enough. Just one question, though; how do you 'wake' it up again? Is it as simple as pressing the power-on button?

Just curious, really. I know with a laptop you'd simply open the lid (I think). Or is that the 'sleep' option?

I get muddled up with the two of them, I confess..! :roll:


Mike. :wink:
Hey mike, as far as my hardware goes. Just pressing the powerbutton works wonders, even pressing a keyboard key on a PS2 Keyboard works also for waking it up.

Posted: Sun 14 Jan 2018, 01:14
by Mike Walsh
@ frenchiveruti:-

Mm. Fair enough! In that case.....thanks for the info. I'll give this a try.

Cheers for the confirmation.


Mike. :wink:

Posted: Sun 14 Jan 2018, 09:11
by fabrice_035
Hi,

My computer (dell xps 1640) restart immediatly after sleep/hibernate :cry:

Why ?

Regard.

Posted: Sun 14 Jan 2018, 11:43
by nic007
fabrice_035 wrote:Hi,

My computer (dell xps 1640) restart immediatly after sleep/hibernate :cry:

Why ?

Regard.
It depends on which sleep mode(s) are available for your system and which you are using. Suspending to RAM does not require a system restart but suspending to HD does.

Re: [HOWTO] Suspend or "sleep" a PC

Posted: Thu 07 Jun 2018, 18:43
by soniabu
frenchiveruti wrote:So, many of the users of puppy linux, use puppy for laptops, those are great suspending because the acpi can read the battery and actually work.
But for PC users like me, the solution is just this command line:

Code: Select all

echo -n mem > /sys/power/state
fantastic !
thx Sonia

Posted: Wed 04 Jul 2018, 20:11
by takenp
BTW

I've been using pm-suspend small program from the pm-utils packadge got from Ubuntu's repo. It worked fine. Still thinking what is better? Or may be pm-suspend does all the same? )

==
UPDATE

It does evidently all the same )

Code: Select all

root# cat /usr/lib/pm-utils/pm-functions | grep state

	if grep -q mem /sys/power/state; then
		do_suspend() { echo -n "mem" >/sys/power/state; }
	elif grep -q standby /sys/power/state; then
		do_suspend() { echo -n "standby" >/sys/power/state; }
	grep -q disk /sys/power/state; then
		echo -n "disk" > /sys/power/state
	grep -q disk /sys/power/state && \
LOL

Posted: Sun 08 Jul 2018, 21:01
by frenchiveruti
takenp wrote:BTW

I've been using pm-suspend small program from the pm-utils packadge got from Ubuntu's repo. It worked fine. Still thinking what is better? Or may be pm-suspend does all the same? )

==
UPDATE

It does evidently all the same )

Code: Select all

root# cat /usr/lib/pm-utils/pm-functions | grep state

	if grep -q mem /sys/power/state; then
		do_suspend() { echo -n "mem" >/sys/power/state; }
	elif grep -q standby /sys/power/state; then
		do_suspend() { echo -n "standby" >/sys/power/state; }
	grep -q disk /sys/power/state; then
		echo -n "disk" > /sys/power/state
	grep -q disk /sys/power/state && \
LOL
Yeah! This is for the command line interface purist like me, that don't like to have 200 programs for a simple set of commands.
Glad it works!

Posted: Fri 29 May 2020, 20:23
by jplt3
@frenchiveruti great thanks fantastic

Too bad that we can not wake up the pc with keyboard or mouse ?

Posted: Fri 29 May 2020, 20:45
by Mike Walsh
jplt3 wrote:@frenchiveruti great thanks fantastic

Too bad that we can not wake up the pc with keyboard or mouse ?
@ jplt3:-

If you use the initial command in the first post, that's exactly what happens! In fact, it's a bit of a juggling act if you're using a desktop, and you're trying to carefully switch the mouse off without moving the cursor.....because the slightest cursor movement will "wake" it up again.

I've stuck a wee script with the command in /usr/sbin, and called it simply 'suspend.sh'.

It's also why, although I've integrated "Suspend-to-RAM" into my Pups' Logout GUI - I've replaced the 'Rebuild Menus' entry, 'cos I prefer to run 'fixmenus' & re-start "X" manually - I've also added a key-binding to /etc/xdg/templates/_rox_jwmrc, which lets me run the command via the "Pause/Break" button. Means I can safely switch the mouse off and put it out of the way before suspending via the "Pause" button.....and when I want to resume, I just hit the biggest key I can find. The space bar..!


Mike. :wink:

Posted: Fri 29 May 2020, 20:56
by jplt3
@Mike Walsh

thanks for your explanation.

In my case it does not work maybe i'am using this tiling window manager DWM ?!

Will try with jwm .

i test on

Code: Select all

cat /etc/os-release 
NAME=Puppy
VERSION="8.0"
ID=puppy_bionicpup64
VERSION_ID=8.0
PRETTY_NAME="bionicpup64 8.0"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:puppy:puppy_linux:8.0"
HOME_URL="http://puppylinux.com/"
SUPPORT_URL="http://www.murga-linux.com/puppy/index.php"
BUG_REPORT_URL="https://github.com/puppylinux-woof-CE/woof-CE"