Wednesday, May 31, 2023

bash script to check URL status from a linux box

 

Wrote a script to check valid urls from linux box, To be executed as below from a linux box

We can keep adding url’s to url.txt. Result will be stored in validURLlist.txt

./url_check.sh < url.txt

 

 #

rm -r validURLlist.txt
while read i
do
  wget --spider $i > /dev/null 2>1
  if [ $? == 0 ]
  then
    echo "em_result:success: "$i  >> validURLlist.txt

  else
 echo "em_result:failue: "$i  >> validURLlist.txt
  fi
done 

No comments: