summaryrefslogtreecommitdiffstats
path: root/lib/adei/adei_print.sh
blob: aca7735b268fd70965dbf8ec7348ea098b4eea71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function adei_print_status {
    cmd="$1"
    online="$2"
    healthy="$3"

    if [[ "$cmd" =~ check_adei_ ]]; then
	echo "$healthy"
    else
	echo "$online $healthy"
    fi
}

function format_time {
    offset=$1
    if [ $offset -ge 86400 ]; then
        echo "$((offset / 86400))d"
    elif [ $offset -ge 3600 ]; then
        echo "$((offset / 3600))h"
    elif [ $offset -ge 60 ]; then
        echo "$((offset / 60))m"
    else
        echo "${offset}s"
    fi
}