feat(user/ping_offline.sh):Add script to ping until it succeeds once
[BK-2020-03.git] / user / ping_offline.sh
... / ...
CommitLineData
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
6delay=10;
7domain="google.com"
8
9if [[ -n "$1" ]]; then domain="$1"; fi;
10
11printf "%s:STATUS:Starting ping...\n" "$(date -Is)";
12while ! ping -c1 "$domain"; do
13 sleep "$delay";
14done;
15printf "%s:Ping resolved.\n" "$(date -Is)";
16exit 0;