One of the windows features I miss in linux is the following: In windows you close the notebook lid and the system suspends to RAM, after a while (configurable) the computer automatically wakes up and proceed to suspend to disk. I know that in linux exists suspend2both mode but that works suspending to disk just before running out of battery which is what I'm trying to avoid.
EDIT: More detailed answer found after searching with the answer data
http://askubuntu.com/questions/12383/how-to-go-automatically-from-suspend-into-hibernate
EDIT2: Those are the steps I've followed using Ubuntu 11.04 on a MSI Wind U100.
First: I've installed tuxonice because hibernation wasn't working on my netbook. As a side-effect the hibernation and wake-up processes are quite fast and very stable. The unique drawback is that the display on hibernate/resume is in text-mode. The easiest way to install tuxonice is by adding the corresponding ppa: https://launchpad.net/~tuxonice/+archive/ppa
Once you have hibernation working this script does all the magic
#!/bin/bash
# Script name: /etc/pm/sleep.d/00rtchibernate
# Purpose: Auto hibernates after a period of sleep
# Edit the "autohibernate" variable below to set the number of seconds to sleep.
curtime=$(date +%s)
autohibernate=7200
echo "$curtime $1" >>/tmp/autohibernate.log
if [ "$1" = "suspend" ]
then
# Suspending. Record current time, and set a wake up timer.
echo "$curtime" >/var/run/pm-utils/locks/rtchibernate.lock
rtcwake -m no -s $autohibernate
fi
if [ "$1" = "resume" ]
then
# Coming out of sleep
sustime=$(cat /var/run/pm-utils/locks/rtchibernate.lock)
rm /var/run/pm-utils/locks/rtchibernate.lock
# Did we wake up due to the rtc timer above?
if [ $(($curtime - $sustime)) -ge $autohibernate ]
then
# Then hibernate
rm /var/run/pm-utils/locks/pm-suspend.lock
/usr/sbin/pm-hibernate
else
# Otherwise cancel the rtc timer and wake up normally.
rtcwake -m no -s 1
fi
fi
By modifying the autohibernate value you change the sleep time after which the machine will wake-up and go instantly into hibernation
NOTE: You may have to install rtcwake, I had already installed but I can't remember if I've installed the package myself.