In the recent OS X 10.4.3, it is possible to “suspend” my powerbook into hibernate mode that does not use any power (see Andrew’s Blog). I write this simple script “sleepmode” to make life slightly easier with this feature.
#!/bin/sh
case ”$1” in
deep)
sudo pmset -a hibernatemode 1
;;
safe)
sudo pmset -a hibernatemode 3
;;
normal)
sudo pmset -a hibernatemode 0
;;
go)
omode=”`pmset -g | grep hibernatemode | cut -f 2`”
sudo pmset -a hibernatemode 1
echo The system is going to the deep sleep in 3 seconds
sleep 3
osascript -e 'tell application "Finder" to sleep'
sudo pmset -a hibernatemode $omode
echo The system is back to it orginal sleep mode
;;
esac
case ”`pmset -g | grep hibernatemode | cut -f 2`” in
0)
echo System is in the Normal Sleep Mode
;;
1)
echo System is in the Deep Sleep Mode
;;
3)
echo System is in the Safe Sleep Mode
;;
esac