pm-hibernate
Have to be root in order to run pm-hibernate
, and since
suid acripts are a nuisance, I coded a small C program which
just calls pm-hibernate
, and set it suid.
Actually, it calls other commands of your choice before pm-hibernate
.
These commands are given as arguments; they are run without privileges.
To have a command run asynchronously, specify --fork
before it.
This was designed to run as an Openbox action, so the command examples
given in the code (scroll down to main()
) are for blanking
the screen.
Don't forget chown root:root <prog-name>; chmod u+s,a-w <prog-name>
, after compiling.
To run pm-suspend
instead of pm-hibernate
replace the relevant string in the code, before compiling. These
commands are better than acpitool -s
, as they allow to
set up hooks on suspending/ resuming; for example, create
/etc/pm/sleep.d/20_dhcp-lease
to release on suspend and
request a new lease on thaw
(see
HOWTO.hooks) so as to avoid that leases expire inadvertently.
Copy and paste the script to your editor of choice. There is a Javascript for that. Otherwise, you may just download it.
Copyright (C) 2024 Alessandro Vesely, all rights reserved except as noted. — JavaScript license information