Script: Gotosleep

Sometimes we need to suspend the machine when certain job is completed. Following is my gotosleep script to suspend my Ubuntu.

# ---- filename: gotosleep ----
# This script will suspend this machine to sleep mode.
gnome-screensaver-command --lock
sleep 1 
dbus-send --system --print-reply --dest="org.freedesktop.Hal" /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Suspend int32:0
# ------------------------------


Ubuntu 11.04 requires HAL to provide abstract view on hardware. Thus,

sudo apt-get install hal

One thought on “Script: Gotosleep

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s