feat(unitproc/bkt-replace_contractions):Add Bash function
[BK-2020-03.git] / user / ping_offline.sh
1 #!/bin/bash
2 # Desc:Marks the time when a remote server can be pinged.
3 # Depends: GNU Coreutils 8.32 (date, sleep), iputils-ping 3:20211215-1 (ping)
4 # Version: 0.0.1
5
6 delay=10;
7 domain="google.com"
8
9 if [[ -n "$1" ]]; then domain="$1"; fi;
10
11 printf "%s:STATUS:Starting ping...\n" "$(date -Is)";
12 while ! ping -c1 "$domain"; do
13 sleep "$delay";
14 done;
15 printf "%s:Ping resolved.\n" "$(date -Is)";
16 exit 0;