How to check whether the web page is up without dowloading any content


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to check whether the web page is up without dowloading any content
# 1  
Old 12-10-2009
Bug How to check whether the web page is up without dowloading any content

Hi
I am writing a script to check wheather the web page is up and running. I dont want to download the web page.. I

I used wget --spider command. but i am not getting anything.

can some one tell me the command to the web page..

if the page is up and running I should send a mail to my frend saying the web page is not down..otherwise i should print a message saying the web page is down.
# 2  
Old 12-10-2009
i guess you can ping the server.
# 3  
Old 12-10-2009
Hi Ahamed. Perhaps you could give this a try:
Code:
website="www.google.gnorky"
if ! wget --spider $website >/dev/null 2>&1; then
  echo Now I should send an email about $website
fi

# 4  
Old 12-10-2009
Quote:
Originally Posted by lackoblacko
i guess you can ping the server.
A ping on a server just checks if the server is online but not if a webserver runs on it son neither if a web page is present Smilie
# 5  
Old 12-10-2009
Question

Hi

Code:
website="www.google.gnorky"
if ! wget --spider $website >/dev/null 2>&1; then
  echo Now I should send an email about $website
fi

for the above code what will be the response.since i am working in the production server i dont want to crash. I want to test the response of a page like http://www.yahoo.com. from the out put of the command i should be able to conclude wheather it is running the page is down

Last edited by pludi; 12-10-2009 at 04:06 PM.. Reason: removed link, code tags please...
# 6  
Old 12-10-2009
The response on stderr and stdout gets discarded and the page does not get downloaded because of the --spider option. What remains is the return code of the wget command. Which is used by the if statement to determine if the page can be loaded (return code 0) or can not be loaded (return code 1).

If you are unsure about a command you could run it on a test server. But you can run this command as a regular user anyway.
# 7  
Old 12-10-2009
Computer

Hi Scrutinizer,
can u explain me this below code and what it does. can i redirect it to another directory other then /dev/.


>/dev/null 2>&1;
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Getting web page content and deliver via mail

Guys could you please help. I want to have shell scripts that get the website html content and same time mail html page to DL. Can any1 help here? (2 Replies)
Discussion started by: AnkitC
2 Replies

2. AIX

check web content - Ksh

Hi everybody! I wonder if I could see some text content of a website, via command line... That could be very helpful, in order to automatize a lot of projects im working on. thx a lot (2 Replies)
Discussion started by: Datinsky
2 Replies

3. UNIX Desktop Questions & Answers

Get a web page through CLI

Is there a way we can get a web page through CLI on a unix machine? Please help! (3 Replies)
Discussion started by: Pouchie1
3 Replies

4. Shell Programming and Scripting

File to web page

Hi all, I am having an XML file. And as per requirement I need to map fields of this file with various field of web page. So how can I use wput command into it ? Regards, gander_ss (3 Replies)
Discussion started by: gander_ss
3 Replies

5. Programming

fetching a web page in C

Hello, I'm a total newbie to HTTP commands, so I'm not sure how to do this. What I'd like is to write a C program to fetch the contents of a html page of a given address. Could someone help with this? Thanks in advance! (4 Replies)
Discussion started by: rayne
4 Replies

6. UNIX for Dummies Questions & Answers

Make a Web page

I'm 13 years of age and I am into computers. I am trying to learn how to make a webpage. I could use the help and I would greatly appriciate it. (1 Reply)
Discussion started by: lydia98
1 Replies

7. UNIX for Dummies Questions & Answers

how do i make a web page

hey uhh this is my first post and i was wondering how do i make a web page for like a small business or something anything will help thanks (3 Replies)
Discussion started by: Neil Peart
3 Replies

8. UNIX for Dummies Questions & Answers

Accessing Web Page

Hello, I am new to unix, but wanted to know how can we fetch data from a web page (i.e. an HTML Page), my requirement is to read an html page and wanted to create a flat file (text file) based on the contents available in the mentioned HTML page. Thanks Imtiaz (3 Replies)
Discussion started by: Imtiaz
3 Replies

9. UNIX for Dummies Questions & Answers

making a web page

Hey im new to unix! I am tryin to create a web page in unix and have done it all but when i try and load it it says permission denied!?> i have chmod a+rx for folder and file to make sure but still permissions wont let me?! any ideas can anyone do a quick run through of how to make a web page... (4 Replies)
Discussion started by: shashora
4 Replies

10. UNIX for Dummies Questions & Answers

Web page hosting

I built my website based on Dreamweaver, on Windows platform. My server uses Unix, and the page doesn't look too good. Is there any way to solve this problem without too much of a headache? (1 Reply)
Discussion started by: PCL
1 Replies
Login or Register to Ask a Question