Advertisement
Guest User

Untitled

a guest
Jul 28th, 2020
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. function validate_url(){
  4. if [[ `wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then echo "true"; fi
  5. }
  6.  
  7. # cound how many files we need to check
  8. n=$(echo $(( $(cat userdata.csv | grep -v -E "asc|sha|torrent" | wc -l) * $(cat mirrors.conf | wc -l) )))
  9.  
  10. while read DATA; do
  11. cat userdata.csv | grep -v -E "asc|sha|torrent" | cut -d'|' -f2 | sed "s|^|$DATA|" |
  12. while IFS= read -r line
  13. do
  14. echo "Checking $n $line"
  15. if [[ $(validate_url "$line") != true ]]; then
  16. echo "Not accessbile"
  17. exit 1
  18. fi
  19. n=$(( n - 1))
  20. done
  21. [[ $? -ne 0 ]] && exit 1
  22. done < mirrors.conf
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement