Solved

check wget system

Posted on 2011-03-16
2
474 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
(Open)LDAP V2.44  search proxy to AD (W2012R2) 37 210
ftp to port 21 4 66
CLI command keep running after close 7 56
python - find anything after $ question. 9 44
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
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 …
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.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

735 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