This is a little C script I threw together for my frame.work laptop running Void Linux.
Usage: panic-nap [OPTIONS]...
-p <percent> The percentage at which to hibernate (1<100)
-s <seconds> How many seconds to sleep between checks
-v Enable verbose printing
-O Enable one-shot mode
-T Test that hibernation worksWithout any options passed it defaults to 5 percent and 1 second.
Caution
This depends upon the sysfs of the Linux kernel to function.
This has only been tested to be functional on the glibc flavor of Void.
I personally could not get hibernation to work on Void musl, other distros may vary.
git clone https://github.com/nythepegasus/panic-nap.git
cd panic-nap
make
# Optionally
# sudo make installThat easy :)