#!/bin/sh # based on a script posted at: # http://thinkwiki.org/wiki/Installing_Ubuntu_7.04_%28Feisty_Fawn%29_on_a_ThinkPad_T61#Suspend # if launched through a lid event and lid is open, do nothing echo "$1" | grep "button/lid" && grep -q open /proc/acpi/button/lid/LID/state && exit 0 # remove USB 1.1 driver #rmmod uhci_hcd #rmmod ehci_hcd # sync filesystem and clock sync /sbin/hwclock --systohc # switch to console FGCONSOLE=`fgconsole` #if [ "$FGCONSOLE" = "7" ] #then # sudo -u lech /usr/bin/xlock -mode blank # sleep 2 #fi chvt 6 # bring down ethernet and unload ethernet module using private scripts cp /tmp/curnet /tmp/sleepnet offline # go to sleep sleep 5 && echo -n "mem" > /sys/power/state # readjust the clock (it might be off a bit after suspend) /sbin/hwclock --adjust /sbin/hwclock --hctosys # reload USB 1.1 driver modprobe uhci_hcd #modprobe ehci_hcd sleep 10 # bring back ethernet using private scripts SLEEPNET=$(cat /tmp/sleepnet) test -x /etc/ibcl/$SLEEPNET && /etc/ibcl/$SLEEPNET start # turn on the backlight and switch back to X chvt $FGCONSOLE