Last active
August 29, 2015 14:03
-
-
Save mjf/1ff2406fecc00e4e695b to your computer and use it in GitHub Desktop.
Record time until host is up
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# Record time until host is up | |
# Copyright (C) 2014 Matous J. Fialka, <http://mjf.cz/> | |
# Released under the terms of The MIT License | |
# Depends on the humantime script: | |
# https://gist.github.com/mjf/1079421#file-humantime | |
if [ $# -ne 1 ] | |
then | |
echo "Usage: ${0##*/} [host]" | |
exit 0 | |
fi | |
s=`date +%s` | |
while : | |
do | |
if ping -qc1 "$1" | |
then | |
break | |
fi | |
done | |
e=`date +%s` | |
humantime "$((e - s))" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment