Suspend then hibernate in systemd 239
Table of Contents
In systemd 239, they have added a new service that handles suspending then hibernating after a given amount of time. This is easier than using external scripts since it comes built-in with this version of systemd. You can check systemd version with
First, you have to define the delay time before the system wakes up and go into hibernation and that should be defined in /etc/systemd/sleep.conf
Here, what we care about is the last line
HibernateDelaySec where you can define delayed time. As you see, I have it set to 15 minutes after suspending.
Lastly, we need to override the default suspend to execute suspend-then-hibernate instead of regular suspend:
ln -s /usr/lib/systemd/system/systemd-suspend-then-hibernate.service /etc/systemd/system/systemd-suspend.service
This will make systemd executes suspend-then-hibernate instead of suspend every time suspend is invoked.
Disclaimer: This is a personal weblog. The opinions expressed here represent my own and not those of any entity with which I have been, am now, or will be affiliated.
- Run native C/C++ code in the browser using Emscripten 18 Nov 2020
- Dynamic DNS using DDclient 16 Feb 2019
- Writing a Chip-8 emulator 17 Sep 2018