Firstly, thankyou to whoever the kind person was that added the
swsuspend patch to the kernel. I remember asking for it some time ago.
It isn't perfect yet, but it's been immensely useful nonetheless.
I thought it might be helpful to share this script which I use to
suspend my box. It's tiny:
#!/bin/sh
# shut down postgres. It trashes databases otherwise.
/etc/rc.d/init.d/postgresql stop
# lock screen so computer isn't wide open when unsuspended.
xscreensaver-command -lock
# wait for locking to complete (cute fadeout thing)
sleep 10
# suspend computer
echo -n "1 0 2" > /proc/sys/kernel/swsusp
# get the network running again
dhcpcd
# set the system clock
/sbin/hwclock --hctosys
# restart postgres
/etc/rc.d/init.d/postgresql start
It needs some extra hacking (like checking whether or not postgres is
running before shutting it down), but it gets the system back to a
usable state after you suspend it and locks the screen so there's no
security problems if the machine is stolen and woken up.
I put that in /usr/sbin and make a symlink in /usr/bin/suspend to
console-helper and put a button for it in my gnome-panel next to the
lock button.
might not be the best solution - requires anyone who wants to suspend to
know the root password, but it's a start. Perhaps a group based solution
is better?
I haven't done it yet but I also want to get the acpi daemon to suspend
when my laptop is short of power. I'll let you know if I get anywhere
with this, but first I need to get my laptop fixed :)
James.