Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script to check urls

Status
Not open for further replies.

olmos

Technical User
Oct 25, 2000
135
US
I am a beginner on scripting. Anyone know how I can script a way to do URL checking for a certain domain? I have a list of urls that I can also feed the script. I want it to be run automatically through a cron. Any examples or ideas?

Thanks in advance,
olmos
 
Hi

Some of the simplest variations with [tt]wget[/tt] :
Code:
[gray]# displays full HTTP response headers[/gray]

wget -S --spider -i /url/list > /output/file

[gray]# displays only brief result, but none if the host is unreachable[/gray]

wget -S --spider -nv -i /url/list > /output/file

[gray]# ensures each URL appears in the log[/gray]

while read u; do echo "$u"; wget -S --spider -nv "$u" ; done < /url/list > /output/file

[gray]# ensures each URL appears in the log and has status specified[/gray]

while read u; do echo "$u"; wget -S --spider -nv "$u" || echo "unreachable"; done < /url/list > /output/file

Feherke.
 
Thanks for your help. One more thing, how do I check if a certain phrase is in each URL being checked?

Thanks again.
olmos
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top