Up to date suspend script?

Using applications, configuring, problems
Post Reply
Message
Author
PaulR
Posts: 249
Joined: Wed 04 May 2005, 18:45
Location: UK

Up to date suspend script?

#1 Post by PaulR »

I'm using an old eeepc netbook hooked up to a hi-fi system purely as a music player. It's currently running Bodhi Linux (installed) but I'd prefer to use Puppy (of course!). It's set up as a 'turn-key' system - it's never powered down but spends most of it's time in 'suspend' where it uses almost no power and is ready to use straight away (I don't want to wait for a boot up when I just want 10 minutes of music while doing the dishes :D )

Can I achieve something like this in Puppy? As it's in RAM I suppose only a partial 'power down' is possible...?

I'm not certain what suspend/hibernate etc actually do but what I'd like to achieve is:

- Blank the screen to protect it
- Use the minimum amount of power
- Be ready to use instantly

I've looked at the threads here on this subject but none seem very recent so any help would be appreciated. Latest 'Precise' would be the version of choice :D

Paul

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#2 Post by Karl Godt »

- Blank the screen to protect it

Code: Select all

pupx
probably works not for the vesa Xorg driver ( look into /var/log/Xorg.0.log for "dpms (dis)enabled" )
Screensaver/Screen Blanking do not protect the screen , they protect the user's eyes .
suspend/
[

Code: Select all

acpitool -s
some acpid scripts use acpitool , others echo 'mem' > /sys/power/state

Otherwise we all are eager here to be told by you how Bodhi does it
ie closing lid blahblah ..

:D

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#3 Post by MochiMoppel »

Precise is the first puppy which doesn't pose any problems for me with suspend.This script works for me:
#!/bin/sh
Xdialog --timeout 5 --no-close --title "$0" --yesno "\n\nSuspend session?\n\n(Defaults to YES after 5 sec)" 0 0
[ $? != 1 ] && sync && echo -n mem > /sys/power/state

PaulR
Posts: 249
Joined: Wed 04 May 2005, 18:45
Location: UK

#4 Post by PaulR »

Thanks for those Karl.

Maybe I meant 'power off the screen'? I just want it to use as little power as possible and not burn pixels onto the screen, my eyes can look after themselves :D

So, what does 'acpitool -s' do exactly?

Closing the lid would be one more bit of hassle :D I press the power on button to resume from the suspended state and choose logout->suspend to suspend. Not very exciting I'm afraid :P

PaulR
Posts: 249
Joined: Wed 04 May 2005, 18:45
Location: UK

#5 Post by PaulR »

MochiMoppel wrote:Precise is the first puppy which doesn't pose any problems for me with suspend.This script works for me:
#!/bin/sh
Xdialog --timeout 5 --no-close --title "$0" --yesno "\n\nSuspend session?\n\n(Defaults to YES after 5 sec)" 0 0
[ $? != 1 ] && sync && echo -n mem > /sys/power/state
Thanks! How do you wake it up again?

Paul

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#6 Post by MochiMoppel »

PaulR wrote:Thanks! How do you wake it up again?
Try the power button. On my computer the power indication lamp blinks while in suspend mode. Pushing the power button wakes the computer from suspend mode.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#7 Post by Karl Godt »

On my EEEPC machine it is the SPACE BAR to wake it up , on my KeyboardPC the Power Button .

ACPITOOL you could find several versions in the additional software section , one by me with glibc-2.10.x and above (racy) .

man acpitool should give you a manual page, except if bloodhi has omitted them to reduce size .
As I had read Buddahi uses enlightenment WM; runtt21 unfortunately had hacked out the e17 logout interface witch had the suspend and resume buttons in recent macpups - but i read from him somewhere years ago there are configuration files in .etc/enlightenment .

/etc/acpi is the dir to look for suspend scripts - otherwise .

PaulR
Posts: 249
Joined: Wed 04 May 2005, 18:45
Location: UK

#8 Post by PaulR »

OK Thanks both, looks like there's enough info there for me to be able to get Puppy installed and doing what I need.

Paul

PaulR
Posts: 249
Joined: Wed 04 May 2005, 18:45
Location: UK

#9 Post by PaulR »

MochiMoppel's script works great for me but I'd like to remove the confirmation dialog. As I'm not familiar with shell scripting syntax would I be right in thinking I could just use a script as follows:

Code: Select all

#!bin/sh
sync
echo -n mem > /sys/power/state
As expected (!) I get a nasty result if I suspend while music is playing but that's no biggie.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#10 Post by Karl Godt »

You can add a lot of things there before finally echoing mem into sys power state ,
like wmexit or a bunch of lines from rc.shutdown to close internet connection , stop drivers by rmmod ing them , stop /etc/init.d/daemons , udevd, klogd, syslogd , pup_event_frontend_d or unmount partitions and such ..

A working acpid daemon could possibly have a relauch part then in /etc/acpi .


About sync :
When there is some read-only partition mounted, sync might hang the script and the lines afterwards might not get executed .

PaulR
Posts: 249
Joined: Wed 04 May 2005, 18:45
Location: UK

#11 Post by PaulR »

Excellent, many thanks - I should maybe research how to stop any music playing (maybe just killing the program would suffice if rather crude!).

Thanks for the tip about read-only too.

Paul

chapchap70
Posts: 210
Joined: Thu 18 Nov 2010, 05:39
Location: The Island Of Long (NY, USA)

The Fatdog suspend script might work for you.

#12 Post by chapchap70 »

I have seen a few threads that are similar with people having trouble with laptops. This might be more than you are looking for Paul: It would require closing and opening the lid and pushing a button. :lol: This might help someone else better.

I think the suspend scripts work on multiple puppies. My Slacko suspend script was copied from Fatdog. I was running Slacko on my Gateway netbook and it would not wake up when I opened the lid no matter what buttons I pushed. When I ran Fatdog64, the suspend script worked.

What I did was copy the Fatdog script and Slacko wakes up the same.

The scripts are located at /etc/acpi/actions


Here is the Fatdog script:

Code: Select all

#!/bin/sh
# suspend.sh 28sep09 by shinobar

# do not suspend at shutdown proccess
if [ "$(cat /proc/acpi/button/lid/*/state | grep open)" != "" ] ; then
exit
fi
for P in acpi_poweroff.sh
do
  ps ax | grep -v 'grep' | grep -q "sh[ ].*$P" && exit
done
for P in wmpoweroff poweroff
do
  pidof "$P" >/dev/null && exit
done

# unmount if usb media mounted
USBS=$( mount | grep $(probedisk2|grep '|usb' | cut -d'|' -f1) | cut -d " " -f 1 | sed 's/dev/mnt/' )
for USB in $USBS
do
	fuser -mk $USB
	umount $USB
done

# process before suspend
# sync for non-usb drives
sync
rmmod ehci_hcd

#suspend

/etc/rc.d/rc.network stop
kill -9 $(pidof wpa_cli)
killall dhcpcd-wpagui
killall dhcpcd
killall wpa_supplicant
echo mem > /sys/power/state 

# process at recovery from suspend
modprobe ehci_hcd
/etc/rc.d/rc.network
/etc/init.d/50-Wpagui start

Here is the Slacko script (which did not work on my netbook)

Code: Select all

#!/bin/sh
# suspend.sh 28sep09 by shinobar

# do not suspend at shutdown proccess
#111129 added suspend to acpi_poweroff.sh
if [ ! -f /tmp/suspend ];then
  for P in acpi_poweroff.sh
  do
    ps ax | grep -v 'grep' | grep -q "sh[ ].*$P" && exit
  done
fi
rm -f /tmp/suspend
for P in wmpoweroff poweroff
do
  pidof "$P" >/dev/null && exit
done

# do not suspend if usb media mounted
USBS=$(probedisk2|grep '|usb' | cut -d'|' -f1 )
for USB in $USBS
do
	mount | grep -q "^$USB" && exit
done

# process before suspend
# sync for non-usb drives
sync
rmmod ehci_hcd

#suspend
echo -n mem > /sys/power/state

# process at recovery from suspend
modprobe ehci_hcd

After looking at this again, Slacko doesn't have the WPA Gui so the Fatdog script doesn't get the internet up automatically in Slacko.

I wonder if other people using Fatdog had to get scripts from elsewhere to get their laptops/netbooks to work properly or if the Fatdog script is better?

PaulR
Posts: 249
Joined: Wed 04 May 2005, 18:45
Location: UK

#13 Post by PaulR »

Thank you chapchap70. I have to say I don't understand most of those scripts but I'm sure others will find them and your comments of use. As I mentioned above Mopimoppel's simple script is working great - my eeepc stays open and ready to play at the touch of it's 'on' button!

Cheers

Paul

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#14 Post by MochiMoppel »

PaulR wrote:Mopimoppel's simple script is working great
Simple? - yes. Great? - not really. I sometimes have to restart internet connection after wakeup, but otherwise I'm pretty happy with it.

I remember that I once fiddled with acpitool, but had issues. I also tried the Fatdog script: After wakeup my desktop was lost and my boot partition unmounted . I'm sure it works on some hardware, but it doesn't on mine.

chapchap70
Posts: 210
Joined: Thu 18 Nov 2010, 05:39
Location: The Island Of Long (NY, USA)

#15 Post by chapchap70 »

I don't understand most of the scripts and exactly how they work but once I saw that the Fatdog script worked, I figured it wouldn't hurt to try it on Slacko after learning from here where the scripts are located.

It might not hurt if other puppy's scripts were pasted here so people having trouble could try copying them to their etc/acpi/actions directories.

To get internet working in Slacko after waking up, I changed the last line from the Fatdog script and I think the second to last line is needed too.

Since I am using frisbee, the last line is:

Code: Select all

/etc/init.d/frisbee start
Instead of:

Code: Select all

/etc/init.d/50-Wpagui start 
It seems like it takes a little longer for my internet connection to get back up and running with frisbee.

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#16 Post by nic007 »

If you only want to put your monitor to sleep,.add the following lines to the xorg.conf file in the ServerLayout section: Option "StandbyTime" "5" and Option "OffTime" "30". 5 and 30 minutes being my settings.

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#17 Post by nic007 »

Is there still no script or software that will suspend/put on standby everything automatically after a specified period of inactivity like can be done with windows? Say for instance I want to put eveything on standby after 30 minutes of non-activity of mouse movement.

chapchap70
Posts: 210
Joined: Thu 18 Nov 2010, 05:39
Location: The Island Of Long (NY, USA)

#18 Post by chapchap70 »

Found this:

http://puppylinux.info/topic/automatic-standby

Remember this one, Karl? 8)

Hope this helps.

User avatar
Ted Dog
Posts: 3965
Joined: Wed 14 Sep 2005, 02:35
Location: Heart of Texas

#19 Post by Ted Dog »

good stuff, be sure to run from RAM and in some hardware like mine, the USB powers off as well, which causes havoc if running with a savefile on a USB. Music files are small, so copy them as well, a multisession Cd/DVD would work well, or if 64bit multisession fatdogs way with USB, it load into RAM and saves back at the end, so USB disconnection will not cause a issue.

Post Reply