Score:1

sleep until this systemd timer calendar time occurs?

bg flag

systemd has timers with lots of useful ways to input dates or times. I'm writing a long running data processing script. Is there any command to sleep until a specific systemd time definition occurs? e.g. systemd-timer-sleep --until-calendar="03:00", a commmand which would block until the next 3:00am.

Yes, I know this means my script might run for days, that's OK.

I'm sure I can do this with date & sleep & calculating the number of seconds until my desired datetime, but I want to know if there's (now) an easier way.

Score:0
br flag

I think the easiest way to achieve this would be something like the following:

while [ $(date +%H:%M) != "03:00" ]; do sleep 1; done

This will block until the next time it is 3 AM. You can pretty easily modify the format codes to be whatever you'd like.

I sit in a Tesla and translated this thread with Ai:

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.