Score:1

Systemd timer with WakeSystem=true waiting for twice the specified time

cn flag

I wanted to understand systemd timers, so I've been fiddling. I've found an odd behavior which is not what I wanted. When I start a systemd timer using WakeSystem=true and OnActiveSec setting the timer, then I suspend, the timer waits for that duration twice instead of once.

Here's an example you can try yourself:

date >> /home/user/Desktop/MyWakeLog.txt;sudo systemd-run --unit='WakeTimer' --on-active='5m'  --timer-property='AccuracySec=1s' --timer-property='WakeSystem=true' /bin/sh -c "date >> /home/user/Desktop/MyWakeLog.txt";sudo systemctl suspend

You'd expect the file MyWakeLog.txt to be written to once, then the timer starts, then it suspends. Then 5 min elapse, the computer wakes up, and the MyWakeLog.txt file is written to again.

But that's not what's happening! The timer wakes the computer up for suspend after 5 minutes, then waits another 5 minutes to write to the log!

Why is this happening? How can I get my computer to wake up after a specified time then immediately write to the log?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.