#!/bin/sh

# preventive sync, not sure whether it's needed
sync; sync; sync;

# change VT to a text-mode console. Change back at the end to unscramble
# the video card
/usr/bin/chvt 1

# suspend
echo -n shutdown > /sys/power/disk
echo -n disk > /sys/power/state

# After the suspend, we restart here...

# resetting the system clock to the hardware clock
/sbin/hwclock --hctosys

# Start dummy X-session
# Needed as long as bug 1220 on freedesktop.org/bugzilla is not resolved
# NOTE: not needed if the two chvt lines work for you.
#/usr/bin/X11/xinit /bin/false -- :1 &

# change back to the X console... 
/usr/bin/chvt 7

# restarting network interfaces. Shouldn't need to do this, but the network 
# comes back up more reliably if we do:
/sbin/ifdown eth0
/sbin/ifup eth0
