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.

1 Answer 1

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 
2
  • 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 Commented Dec 3, 2018 at 11:41
  • @Sollosa, I edit my answer. Commented Dec 3, 2018 at 13:56

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.