home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / etc / acpi / powerbtn.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  2009-04-28  |  517 b   |  19 lines

  1. #!/bin/sh
  2. # /etc/acpi/powerbtn.sh
  3. # Initiates a shutdown when the power putton has been
  4. # pressed.
  5.  
  6. # Skip if we just in the middle of resuming.
  7. test -f /var/lock/acpisleep && exit 0
  8.  
  9. # If gnome-power-manager or kded4 are running, let
  10. # them handle policy This is effectively the same as 'acpi-support's
  11. # '/usr/share/acpi-support/policy-funcs' file.
  12.  
  13. if pidof gnome-power-manager kded4 > /dev/null; then
  14.     exit
  15. fi
  16.  
  17. # If all else failed, just initiate a plain shutdown.
  18. /sbin/shutdown -h now "Power button pressed"
  19.