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.

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
  • 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 3 '18 at 11:41
  • @Sollosa, I edit my answer. – Romeo Ninov Dec 3 '18 at 13:56

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.