lid_state=/proc/acpi/button/lid/LID0/state
test -e $lid_state || exit 0
if cat $lid_state | grep closed > /dev/null
then echo "lid closed - suspending"
#CONSOLE="fgconsole"
chvt 1
#rmmod ipw2200
#rmmod b44
rmmod ehci_hcd
rmmod uhci_hcd
#/etc/rc.d/rc.networkmanager stop

/usr/bin/dbus-send --system --dest=org.freedesktop.NetworkManager
--type=method_call /org/freedesktop/NetworkManager org.freedesktop.NetworkManager.sleep

echo "mem" > /sys/power/state


modprobe i830
/usr/bin/video_post
#chvt $CONSOLE
chvt 1
chvt 7
/etc/rc.d/rc.hal restart
/etc/rc.d/rc.hotplug restart
#modprobe ipw2200
#modprobe b44

/usr/bin/dbus-send --system --dest=org.freedesktop.NetworkManager
--type=method_call /org/freedesktop/NetworkManager org.freedesktop.NetworkManager.wake

#/etc/rc.d/rc.hotplug restart
/etc/rc.d/rc.avahidaemon restart
#/etc/rc.d/rc.networkmanager restart
else echo "lid opened - resuming"
fi

AdamSchreiber/acpi script (last edited 2008-02-03 14:48:11 by localhost)