Skip to content

Instantly share code, notes, and snippets.

@xmonader
Created November 14, 2016 14:20
Show Gist options
  • Select an option

  • Save xmonader/107e98e9e8391a2ef0072901fbf44f4e to your computer and use it in GitHub Desktop.

Select an option

Save xmonader/107e98e9e8391a2ef0072901fbf44f4e to your computer and use it in GitHub Desktop.
parallel links checker
set +ex
if [ ! `which parallel` ]
then
echo "[-] Parallel isn't installed";
exit 1
fi
my_ping() {
link=$1
ping -c 2 $link
}
export -f my_ping
# We got a file of links to check
if [ "$#" -eq 1 -a -e $1 ]
then
parallel -a $1 my_ping
fi
# We got links in the stdin
if [ "$#" -eq 0 ]
then
v=$(cat /dev/stdin)
parallel my_ping ::: $v
fi
~
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment