Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- function validate_url(){
- if [[ `wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then echo "true"; fi
- }
- # cound how many files we need to check
- n=$(echo $(( $(cat userdata.csv | grep -v -E "asc|sha|torrent" | wc -l) * $(cat mirrors.conf | wc -l) )))
- while read DATA; do
- cat userdata.csv | grep -v -E "asc|sha|torrent" | cut -d'|' -f2 | sed "s|^|$DATA|" |
- while IFS= read -r line
- do
- echo "Checking $n $line"
- if [[ $(validate_url "$line") != true ]]; then
- echo "Not accessbile"
- exit 1
- fi
- n=$(( n - 1))
- done
- [[ $? -ne 0 ]] && exit 1
- done < mirrors.conf
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement