Created
March 29, 2018 14:16
-
-
Save crmsoft/6ae45fed8cd21581f1a1150d210d405b to your computer and use it in GitHub Desktop.
debain ping domains parallel
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/bash | |
response=$(ping -c 2 $1 | tail -1| awk '{print $4}' | cut -d '/' -f 3) | |
echo "$1 = $response" |
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/bash | |
for cmd in "$@"; do { | |
$cmd & pid=$! | |
PID_LIST+=" $pid"; | |
} done | |
trap "kill $PID_LIST" SIGINT | |
wait $PID_LIST | |
# ./run_parallel.sh './ping.sh host_1' './ping.sh host_2' ... './ping.sh host_n' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment