Skip to content

Instantly share code, notes, and snippets.

@crmsoft
Created March 29, 2018 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crmsoft/6ae45fed8cd21581f1a1150d210d405b to your computer and use it in GitHub Desktop.
Save crmsoft/6ae45fed8cd21581f1a1150d210d405b to your computer and use it in GitHub Desktop.
debain ping domains parallel
#!/bin/bash
response=$(ping -c 2 $1 | tail -1| awk '{print $4}' | cut -d '/' -f 3)
echo "$1 = $response"
#!/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