How can I get a notification if wget can not reach a site in x seconds?

2

How can I set a timeout for wget and get a notification the connection times out in 20 seconds?

So far I've tried the following command

   wget  --spider www.example.com

Murat İNAN

Posted 2014-05-27T12:02:25.717

Reputation: 29

It is not clear what you are asking – Bruno9779 – 2014-05-27T12:11:44.133

@Bruno9779 sorry for my english. i want to get any alert if url doesnt response in time limit. – Murat İNAN – 2014-05-27T12:16:15.607

what is the context you are using wget? as part of a script? or raw command line? – Bruno9779 – 2014-05-27T12:20:14.003

@Bruno9779 on command line. – Murat İNAN – 2014-05-27T12:21:56.700

1Wow, downvote-fest! Come on guys, if you are going to downvote at least have the decency to explain why so that people can improve their questions and answers. – Julian Knight – 2014-05-27T14:04:53.973

Answers

1

wget -T 20 --spider www.example.com || ping -n 1 www.example.com

However, ICMP/pings aren't always useful for determining site availability since they have been used in distributed denial of service attacks since the beginning of the century.

whatchaDoForWeekends

Posted 2014-05-27T12:02:25.717

Reputation: 43

thnx to you. i did it! – Murat İNAN – 2014-05-27T12:31:17.190