# Using HAL to suspend from the command line

## Gullible Jones

Is there any way at all to call on HAL to suspend from the CLI, the same way that e.g. gnome-power-manager or kpowersave do? I like to use light window managers, and I want to have a menu entry for suspend/hibernate; and it just seems stupid to me to use sudo when I don't have to.

----------

## mrsteven

This works for suspend to disk:

```
$ qdbus --system org.freedesktop.Hal /org/freedesktop/Hal/devices/computer 'org.freedesktop.Hal.Device.SystemPowerManagement.Hibernate'
```

For suspend to ram you'd have to change "Hibernate" to "Suspend" and pass a parameter, but I don't know how qdbus handles parameters. "Suspend(0)" and "Suspend 0" don't work.

qdbus is in x11-libs/qt-dbus.

----------

## neuron

whatis pm

(needs pm-utils)

----------

## 165177

```
dbus-send --system --type=method_call --dest=org.freedesktop.Hal /org/freedesktop/Hal/devices/computer 'org.freedesktop.Hal.Device.SystemPowerManagement.Suspend' int32:0
```

dbus-send is contained in dbus itself, thus no additional installation is required.

If solid is installed and running, "solid-powermanagement suspend to_ram" (or "to_disk") can be used.

----------

## mikegpitt

Cool... I wasn't aware of these alternate suspend methods.  I use FVWM, so I also need to su or sudo when I run hibernate.

----------

