Solved

check wget system

Posted on 2011-03-16
2
468 Views
Last Modified: 2013-12-16
hello there,
I would like to check a website to see if its alive with wget.. for example
"wget mysite.com" every minute and if it doesnt respond send me an email..
but im having a little issue and sometimes the site doesnt answer and times out..
how can I create a little script for this? thanks
0
Comment
Question by:XK8ER
2 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 250 total points
Comment Utility
#!/bin/sh
if ! wget --tries=1 --spider -O /dev/null mysite.com >/tmp/wgetlog.$$ 2>&1
    then
      mailx -s "Error occurred with  mysite.com" XK8ER@domain.tld < /tmp/wgetlog.$$
fi
rm -f /tmp/wgetlog.$$
exit

Run it via cron on a regular basis.

wmp
0
 
LVL 3

Assisted Solution

by:Alberto Cortes
Alberto Cortes earned 250 total points
Comment Utility
You can use next script:

if ! wget --timeout=60 --spider -o /dev/null http://mysite/index.html
then mailx -s "timeout error with http://mysite" user@email
fi


This will check URL and you control the timeout in seconds. Notice that timeout can be DNS lookup delay, connect dealy, and read delay.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now