0

I have a list of domains in a file say list.txt I've got a report that many of these domains showing "Database Connection Error" I want to know all domains that can't connect with db properly. I thought curl could be a useful utility for that, so I try

curl -sSf http://`cat list.txt` > /dev/null | grep -I "database connection error"

But with that I get whole bunch of other issues, I still get others errors in output, also (the bigger concern) I do not get domain name for which that error outputs. Please someone help me.

Sollosa
  • 137
  • 1
  • 7

1 Answers1

0

Make the things in loop.

for i in `cat list.txt`;
do
if [ "$(curl -sSf http://$i 2>/dev/null | grep -i 'database connection error')" != "" ]
then echo $i
fi
done
Romeo Ninov
  • 5,263
  • 4
  • 20
  • 26
  • got it amigo.. but I get all sorts of other errors too, which I want to reduce. Here are examples... curl: (22) The requested URL returned error: 503 Service Temporarily Unavailable curl: (22) The requested URL returned error: 503 Service Temporarily Unavailable curl: (22) The requested URL returned error: 503 Service Temporarily Unavailable curl: (6) Could not resolve host: cpec1.co.uk; Name or service not known – Sollosa Dec 03 '18 at 11:41
  • @Sollosa, I edit my answer. – Romeo Ninov Dec 03 '18 at 13:56