Update to allow next-day times
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
801f0ff65c
commit
a824953ded
1 changed files with 2 additions and 1 deletions
|
@ -7,6 +7,7 @@ time=${1:-}
|
|||
[ -z "${time}" ] && fail "No time specified"
|
||||
|
||||
tdiff=$(($(date -d "$1" +%s) - $(date +%s)))
|
||||
step "Sleeping ${tdiff}s until ${time}..."
|
||||
[ $tdiff -gt 0 ] || tdiff=$((tdiff + 86400))
|
||||
|
||||
step "Sleeping ${tdiff}s until $(date -d "now + ${tdiff} seconds" "+%Y-%m-%d %H:%M:%S")..."
|
||||
sleep ${tdiff}
|
||||
|
|
Loading…
Reference in a new issue