aboutsummaryrefslogblamecommitdiffstats
path: root/compose/production/postgres/maintenance/_sourced/countdown.sh
blob: e6cbfb6ffc2996031dae959b1ebf3e1f71b77551 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                                                             
#!/usr/bin/env bash


countdown() {
    declare desc="A simple countdown. Source: https://superuser.com/a/611582"
    local seconds="${1}"
    local d=$(($(date +%s) + "${seconds}"))
    while [ "$d" -ge `date +%s` ]; do
        echo -ne "$(date -u --date @$(($d - `date +%s`)) +%H:%M:%S)\r";
        sleep 0.1
    done
}