Bug#1070487: ITP: sleepuntil -- sleeps until a specified datetime
On Wed, Apr 09, 2025 at 10:59:21AM +0200, Jakub Wilk wrote:
> * Bart Martens <bartm@debian.org>, 2025-04-05 16:28:
> > Both links on the bug report produce 404.
>
> https://github.com/MatMasIt says "I am now hosting my repositories on a
> Gitea instance at gitea.mattiaturin.duckdns.org"... but that doesn't work
> either.
>
> I'm attaching archive of the git repo, so that people can take a look.
>
> > And "sleep $((60*60*2))" very easy in my view,
>
> You mean "sleep 2h"? But that's not what this program does.
>
> Theses are examples from the manpage:
>
> sleepuntil 'tomorrow 8:00'
> Sleep until tomorrow 8:00.
>
> sleepuntil 10pm && evening_task
> Sleeps until 10pm, then evening_task is executed.
It is really easy in bash.
sleepuntil() {
until=$( date --date "$1" +%s )
now=$( date +%s )
sleep $(( $until - $now ))
eval "$2"
}
sleepuntil 'tomorrow 8:00'
sleepuntil '10pm' && echo 'evening task'
>
> A tool for sleeping until a specific time would be definitely useful, but I
> don't think this implementation is mature enough for Debian.
>
> --
> Jakub Wilk
Reply to: