Created
November 14, 2016 14:20
-
-
Save xmonader/107e98e9e8391a2ef0072901fbf44f4e to your computer and use it in GitHub Desktop.
parallel links checker
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
| 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