Re: how to run script after suspend to disk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
> 
> 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
> 
> 
This is no doubt a stupid question but I have to ask. Why can't we
impliment the suspend event by the lines:
event=button/sleep
action=/usr/bin/acpitools -s

This causes the suspension when you hit the suspend button but when you
resume by pushing the power button the running of the machine quickly
locks up. What is the reason?
--
=======================================================================
Has everybody got HALVAH spread all over their ANKLES?? ... Now, it's
time to "HAVE A NAGEELA"!!
=======================================================================
Aaron Konstam telephone: (210) 656-0355 e-mail: akonstam@xxxxxxxxxxxxx


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux