#!/bin/bash
echo -n mem > /sys/power/state
 
while [ `cat /proc/acpi/button/lid/LID0/state | sed -e 's/state\:[ ]*\(.*\)/\1/g'` != "open" ]
do
	echo -n mem >/sys/power/state
done