Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 20 Nov 2018, 21:57
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
Up to date suspend script?
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [19 Posts]   Goto page: 1, 2 Next
Author Message
PaulR

Joined: 04 May 2005
Posts: 249
Location: UK

PostPosted: Sun 15 Sep 2013, 05:20    Post subject:  Up to date suspend script?  

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 Very Happy )

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 Very Happy

Paul
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 4208
Location: Kiel,Germany

PostPosted: Sun 15 Sep 2013, 05:38    Post subject:  

Quote:
- Blank the screen to protect it
Code:
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 .

Quote:
suspend/
[
Code:
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 ..

Very Happy
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1682
Location: Japan

PostPosted: Sun 15 Sep 2013, 05:50    Post subject:  

Precise is the first puppy which doesn't pose any problems for me with suspend.This script works for me:
Quote:
#!/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
Back to top
View user's profile Send private message 
PaulR

Joined: 04 May 2005
Posts: 249
Location: UK

PostPosted: Sun 15 Sep 2013, 05:55    Post subject:  

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 Very Happy

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

Closing the lid would be one more bit of hassle Very Happy I press the power on button to resume from the suspended state and choose logout->suspend to suspend. Not very exciting I'm afraid Razz
Back to top
View user's profile Send private message 
PaulR

Joined: 04 May 2005
Posts: 249
Location: UK

PostPosted: Sun 15 Sep 2013, 05:57    Post subject:  

MochiMoppel wrote:
Precise is the first puppy which doesn't pose any problems for me with suspend.This script works for me:
Quote:
#!/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
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1682
Location: Japan

PostPosted: Sun 15 Sep 2013, 06:40    Post subject:  

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.
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 4208
Location: Kiel,Germany

PostPosted: Sun 15 Sep 2013, 06:50    Post subject:  

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 .
Back to top
View user's profile Send private message 
PaulR

Joined: 04 May 2005
Posts: 249
Location: UK

PostPosted: Sun 15 Sep 2013, 07:05    Post subject:  

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
Back to top
View user's profile Send private message 
PaulR

Joined: 04 May 2005
Posts: 249
Location: UK

PostPosted: Sun 15 Sep 2013, 10:53    Post subject:  

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:

#!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.
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 4208
Location: Kiel,Germany

PostPosted: Sun 15 Sep 2013, 11:11    Post subject:  

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 .
Back to top
View user's profile Send private message 
PaulR

Joined: 04 May 2005
Posts: 249
Location: UK

PostPosted: Sun 15 Sep 2013, 11:16    Post subject:  

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
Back to top
View user's profile Send private message 
chapchap70

Joined: 18 Nov 2010
Posts: 205
Location: The Island Of Long (NY, USA)

PostPosted: Wed 18 Sep 2013, 23:21    Post subject: The Fatdog suspend script might work for you.  

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. Laughing 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:
#!/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:
#!/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?
Back to top
View user's profile Send private message 
PaulR

Joined: 04 May 2005
Posts: 249
Location: UK

PostPosted: Thu 19 Sep 2013, 02:23    Post subject:  

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
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1682
Location: Japan

PostPosted: Thu 19 Sep 2013, 02:58    Post subject:  

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.
Back to top
View user's profile Send private message 
chapchap70

Joined: 18 Nov 2010
Posts: 205
Location: The Island Of Long (NY, USA)

PostPosted: Thu 19 Sep 2013, 17:04    Post subject:  

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:
/etc/init.d/frisbee start


Instead of:
Code:
/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.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [19 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1118s ][ Queries: 12 (0.0109s) ][ GZIP on ]