Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Script to find whether link is up
Name: Net Date: October 6, 2008 at 08:39:16 Pacific OS: SUN CPU/Ram: 256 Product: .
Comment:
I need to check the availability of a web page for every one hour through a script. Following is the requirement.
1. Go to http://someone.com 2. If any error encountered in opening the home page, it should trigger an email with the appropriate error message.
Name: nails Date: October 7, 2008 at 21:46:47 Pacific
Reply:
You might try using the lynx browser command. lynx is used by character devices so it works well in a script:
#!/bin/bash
# website to check web="http://www.computing.nnet"
# The exit code of the lynx command equals zero if it can open the webpage else it is non-zero if it can not:
lynx -dump "$web" &> /dev/null if [[ $? -eq 0 ]] then echo "$web web page exists" else echo "$web web page does NOT exist. Execute the email command" fi
lynx is typically bundled with Linux, but isn't always installed on other distributions. If you don't have it, this is the homepage:
Summary: Hi All, I need to write a script to find out if a specific file is older than an hour, if it is then the script has to email me to alert me. Does anyone know how to do this. Thanks Dave. ...
Summary: It seems that I didn't explain myself well in the first response because what I meant agrees with what you said Jim but I ll explain more by giving an example: - let's assume that file1 and file 2 wer...