Last active
November 1, 2020 10:24
-
-
Save dkarmalita/25225177299bcf7f80584b8d13fc5a0c to your computer and use it in GitHub Desktop.
Ping Log * ping logger with date/time stamp and caffeinate, OSX
This file contains 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
#! /usr/bin/env bash | |
# kard 20201020, https://gist.github.com/dkarmalita/25225177299bcf7f80584b8d13fc5a0c | |
# OSX, | |
# Run pins with date/time stamps in each line. It stores the log in the ping.log | |
# file within the current working directory and opens the Console application within | |
# the log opened. Also, it uses caffeinate to prevent the computer from fall to sleep. | |
# After the script finishing, all of the processes are automatically closed. | |
echo Ping logger starts at $(date "+%H:%M:%S %d/%m/%y") | |
caffeinate -di & | |
ping www.google.com | while read line; do echo `date` - $line; done >> ping.log & | |
open ping.log | |
echo The log is saving into "$(pwd)/ping.log" | |
n="_" | |
while [ $n != "q" ] | |
do | |
echo "Press q to quit" | |
read -rsn1 n | |
done | |
pkill -9 ping | |
pkill -9 Console | |
pkill -9 caffeinate | |
echo Bye-Bye! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment