how to run script after suspend to disk - but I have a problem with it.

Aaron Konstam akonstam at sbcglobal.net
Tue May 2 20:02:53 UTC 2006


On Sat, 2006-04-29 at 23:06 -0500, Paul Johnson wrote:
> I use the acpi support under /etc/acpi/events and /etc/acpi/actions
> for sleep.  The event represents a lid closure or FN-Suspend and
> points at an action file. The script in the action directory tells the
> system what to do.
> 
> The sleep.sh file I now use is here.If you want something to happen
> after awaking from suspend mode, it should be easy to see where to put
> it in.
Ok. I will admint that I am confused. The script below certainly puts
the machine in suspend to memory mode. But I am at a loss how to wake
the machine up. I am mising something her and I need clarification. If I
use the power button to wake the machine up the machine wakes up but is
quickly frozen. That is what one does in Windows but it does not work
here. How is the wake up done?
> 
> I do not have any luck with the "hibernate" rpm or the
> "gnome-power-manager" rpms, but the basic acpi method does work here.
> 
> ------------------/etc/acpi/events/sleep----------------------------
> 
> # /etc/acpid/events/sleep
> 
> event=button[/]sleep
> action=/etc/acpi/actions/sleep.sh %e
> 
> -----------------------------------------------------------------------------------------
> 
> 
> 
> ------------------/etc/acpi/actions/sleep.sh
> #!/bin/sh
> #
> # ACPI suspend to ram script
> #
> # http://www.kananov.com/notes/s3
> 
> #Modules to unload before suspend. This are known troublemakers!
> MODULES="tg3 uhci_hcd ehci_hcd hci_usb ipw2200"
> 
> ###if you use linuxant modem drivers you also need this
> ##MODULES="$MODULES hsfusbcd2 hsfmc97ali hsfmc97via hsfmc97ich
> hsfpcibasic2 hsfserial hsfengine hsfosspec hsfsoar"
> 
> 
> 
> set -x
> 
> ##########################################################################
> # HELPER FUNCTIONS
> ##########################################################################
> 
> # function to remove modules
> rmmodules () {
> 
>  for mname in $MODULES ; do
>      if grep $mname /proc/modules ; then
>          rmmodule $mname
>      fi
>  done
> 
> }
> 
> # function to remove module and all dependant modeles via recursive calls
> rmmodule() {
>   # module name
>   m=$1
>   # get list of dependant modules
>   dep_m=`lsmod | grep "^$m" | awk ' { print $4}'`
>   if [ "x$dep_m" != "x" ] ; then
>       for m1 in $dep_m ; do
>           rmmodule $m1
>       done
>   fi
>   /sbin/rmmod $mname
>   echo /sbin/modprobe $mname >> /var/run/acpi-resume-post
> }
> 
> 
> ##########################################################################
> # MAIN PART
> ##########################################################################
> 
> 
> # source sleep config
> #. /etc/sysconfig/acpi-sleep
> 
> # do not got to suspend mode if some command fails!
> set -e
> 
> # sync software time to hw
> 
> hwclock --systohc
> 
> # remove problematic modules
> rmmodules
> 
> # sync write cache
> sync
> 
> # sleep
> echo mem > /sys/power/state
> 
> # reinsert modules
> if [ -f /var/run/acpi-resume-post ]; then
>    sh /var/run/acpi-resume-post &> /dev/null
>    rm -f /var/run/acpi-resume-post
> fi
> 
> #
> hwclock --hctosys
> 
> # restart HAL
> service haldaemon restart
> 
> 
> On 4/20/06, wwp <subscript at free.fr> wrote:
> > Hello Petr,
> >
> >
> > On Wed, 19 Apr 2006 00:52:22 +0200 Petr Fischer <petr.fischer at praguesoft.cz> wrote:
> >
> > > Mikkel L. Ellertson píše v Út 18. 04. 2006 v 09:22 -0500:
> > > > Petr Fischer wrote:
> > > > > Hi,
> > > > >
> > > > > how to run my own script when starting from "hibernate" mode? (I need to
> > > > > restart squid and correct centrino-voltages and fan speeds).
> > > > >
> > > > > rc.local is called on "regular starting" only, right?
> > > > >
> > > > > Thanks, pf
> > > > >
> > > > You may want to take a look at /etc/sysconfig/suspend and the
> > > > /etc/sysconfig/suspend-scripts directory tree...
> > > >
> > >
> > > No similar files on my system :(
> >
> > Neither here.
> >
> > BTW, is pm-hibernate the right command to suspend-to-disk? Why is there no
> > hibernate entry in the GNOME menus?
> >
> >
> > Regards,
> >
> > --
> > wwp
> >
> >
> > --
> > fedora-list mailing list
> > fedora-list at redhat.com
> > To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
> >
> >
> >
> 
> 
> --
> Paul E. Johnson
> Professor, Political Science
> 1541 Lilac Lane, Room 504
> University of Kansas
> 
--
=======================================================================
Peanut Blossoms 4 cups sugar 16 tbsp. milk 4 cups brown sugar 4 tsp.
vanilla 4 cups shortening 14 cups flour 8 eggs 4 tsp. soda 4 cups peanut
butter 4 tsp. salt Shape dough into balls. Roll in sugar and bake on
ungreased cookie sheet at 375 F. for 10-12 minutes. Immediately top each
cookie with a Hershey's kiss or star pressing down firmly to crack
cookie. Makes a heck of a lot.
=======================================================================
Aaron Konstam telephone: (210) 656-0355 e-mail: akonstam at sbcglobal.net




More information about the fedora-list mailing list