Lid close ubuntu hibernate

The following is designed to work EVEN if you have not logged into a desktop environment.

File name:

#!/bin/sh grep -q open /proc/acpi/button/lid/LID/state && exit 0
killall mplayer
sudo hibernate

(TODO May be it is better to check for close state instead of open?)

event=button[ /]lid action=/etc/acpi/

Restart ACPI
service acpid restart