Solved

check wget system

Posted on 2011-03-16
2
475 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 250 total points
ID: 35145823
#!/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
ID: 35149520
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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.

752 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