On 02.03.2022 17:45, Carlos E. R. wrote:
On Wednesday, 2022-03-02 at 12:56 +0100, Parodper wrote:
O 02/03/22 ás 12:49, Dave Howorth escribiu:
On Wed, 2 Mar 2022 12:26:04 +0100 (CET) "Carlos E. R." <> wrote:
Long ago we decided there was no way to do it. Is there now some way?
Surely it's easy? You just have a script always running
Instead of always running, you can try to create a systemd unit that runs after hibernate.target.
Maybe examine "systemctl status hibernate.target" output.
cer@Telcontar:~> systemctl status hibernate.target ● hibernate.target - Hibernate Loaded: loaded (/usr/lib/systemd/system/hibernate.target; static) Active: inactive (dead) Docs: man:systemd.special(7)
Feb 28 10:23:51 Telcontar systemd[1]: Reached target Hibernate. Feb 28 10:23:51 Telcontar systemd[1]: Stopped target Hibernate. Feb 28 17:53:35 Telcontar systemd[1]: Reached target Hibernate. Feb 28 17:53:35 Telcontar systemd[1]: Stopped target Hibernate. Feb 28 20:24:14 Telcontar systemd[1]: Reached target Hibernate. Feb 28 20:24:14 Telcontar systemd[1]: Stopped target Hibernate. Mar 01 12:00:50 Telcontar systemd[1]: Reached target Hibernate. Mar 01 12:00:50 Telcontar systemd[1]: Stopped target Hibernate. Mar 02 03:38:31 Telcontar systemd[1]: Dependency failed for Hibernate. Mar 02 03:38:31 Telcontar systemd[1]: hibernate.target: Job hibernate.target/start failed with result 'dependency'. cer@Telcontar:~>
Notice that the status itself is not failed, so can't be used.
Targets cannot fail, they are either active or not. Still, systemd will start units listed in target's OnFailure when target start job failed.
Oh, wait! the actual output in the log is:
syslog: <3.3> 2022-03-02T03:38:30.497553+01:00 Telcontar systemd-sleep 15519 - - Failed to suspend system. System resumed again: Cannot allocate memory
journal: Mar 02 03:38:30 Telcontar systemd-sleep[15519]: Failed to suspend system. System resumed again: Cannot allocate memory
It is not the same reason as the status text says.
Telcontar:~ # systemctl status sleep.target ● sleep.target - Sleep Loaded: loaded (/usr/lib/systemd/system/sleep.target; static) Active: inactive (dead) since Wed 2022-03-02 03:38:31 CET; 9h ago Docs: man:systemd.special(7)
Mar 02 03:38:17 Telcontar systemd[1]: Reached target Sleep. Mar 02 03:38:31 Telcontar systemd[1]: Stopped target Sleep. Telcontar:~ # systemctl status sys Display all 218 possibilities? (y or n) Telcontar:~ # systemctl status systemd-sleep Unit systemd-sleep.service could not be found. Telcontar:~ #