CMD to check status of the server using Wget


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users CMD to check status of the server using Wget
# 1  
Old 08-31-2015
Hammer & Screwdriver CMD to check status of the server using Wget

Hi All,

Using Wget I'm able to get the status of the server.....only when the server is completely down or up....
but problem here in script is Suppose if the server got hang I mean to say that if the server is taking long time to login, for example normally the server takes 3 seconds to login ...but if the server takes more than 10 seconds or 1min to login...in this case the wget cmd is not providing expected results

then how Do I know that server is taking more time to respond/login
in this case how can I get a resolution..

Code:
URL1="dellsys01.sys.com:8080"
RESULT=$((time wget  --user=samuel --password=12345 -O log.err -q $URL1 ;) 2>&1 || echo "Not Running")
echo "$RESULT" >> output.rslt
wget_status=`awk 'NR==5' output.rslt`
echo "$wget_status"
if [ "$wget_status" == "Not Running" ]
        then
echo `date` "dellsys01 console is not responding"
if
rm output.rslt


Last edited by manohar2013; 08-31-2015 at 04:41 AM.. Reason: Add CODE and ICODE tags.
# 2  
Old 08-31-2015
Please use code tags as required by forum rules!

You may want to consider the
Quote:
--connect-timeout=seconds
Set the connect timeout to seconds seconds. TCP connections that take longer to establish will be aborted. By default, there is no connect timeout, other than that implemented by system libraries.
option to wget and check the exit status code.
# 3  
Old 08-31-2015
I didnt get you.....You mean to say that is there any solution for this problem..

how can I use the parameter connect-timeout=seconds in my code...can you please help me out

Last edited by manohar2013; 08-31-2015 at 05:41 AM.. Reason: any aletrnate solution
# 4  
Old 08-31-2015
Right after the wget command.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Test exit status of last cmd via ssh

see below for a housekeeping script which constructs an ssh cmd using some server/path/sudo info found in $HRINST. the script should hop to each server and if it finds a file to cleanup, moves it to the archive dir if there is nothing to move, it should report so and email the output ... (3 Replies)
Discussion started by: jack.bauer
3 Replies

2. UNIX for Dummies Questions & Answers

302 server status code to 301/404 server status code

Hello, Sorry for my english. I have an arcade site. mydomain.com/game.html If database has the game name is good. mydomain.com/fd43f54.html if database has not the game name redirect to mydomain.com by 302 error code. if database has not the game name i want a 301/404 error code and no... (0 Replies)
Discussion started by: hoo
0 Replies

3. Shell Programming and Scripting

wsadmin script using jython to check application server status in websphere

Hello All, I need a wsadmin script using jython to monitor server status in websphere. kindly help. (0 Replies)
Discussion started by: coolguyamy
0 Replies

4. UNIX for Advanced & Expert Users

how to check weblogic server status in Unix machine

Hi All,Could anybody help in suggesting how to check the weblogic server status in a Unix machine? ps -ef |grep "startWeblogic.sh" The above command would give the running status but can anyone throw some light how to check if it is in hung/down state. Thanks (1 Reply)
Discussion started by: RSC1985
1 Replies

5. Shell Programming and Scripting

wget to check an URL

I all, I wrote an script which starts a Weblogic server and waits until its loaded to deploy several apps. The way I checked was something like: while ; do wget --spider <URL>:<port>/console > /dev/null 2>&1 rc=$? done This works perfectly because it's an HTML site and when server is... (2 Replies)
Discussion started by: AlbertGM
2 Replies

6. Shell Programming and Scripting

how to find status of last executed cmd in perl?

In shell we can find the status of last executed command by $? In perl what is the command to find the status of last executed command... Can any one please say??????????????? Thanks, Prabhu (1 Reply)
Discussion started by: prsampath
1 Replies

7. Shell Programming and Scripting

Using wget and check for non-zero files

Hello, I'm using a shell script containing a wget-command that copies html-files from a website to my ISP-server. I therefore want to check if that file exist and also if the filessize is larger than e.g. 100 bytes. Probably it's done by using something like fileexist and filesize. The wget... (3 Replies)
Discussion started by: weatherboys
3 Replies

8. Programming

How to check TCP server status

Please tell me according to C/C++ socket programming; how client can check whether server is running or not during TCP communication. (1 Reply)
Discussion started by: mansoorulhaq
1 Replies

9. Shell Programming and Scripting

How to check the file status in a remote server?

Hi All, Thanks in Advance. My requirement is there are some data files to be updated(some times new files get created) regularly in server A, these files are to be updated to the server B(backup server) by using SCP, I have to write a script for this purpose, before copying the files to server... (3 Replies)
Discussion started by: rajus19
3 Replies

10. Shell Programming and Scripting

check the status and send an email with status

Hi, We have a text file which has the following data. ISA~00~ ~00~ ~ZZ~VISTN ~ZZ~U1CAD ~051227~183 7~U~00200~000011258~0~P~< GS~FA~EE05J~U1CAD~051227~1831~000011258~X~002002 ST~997~0001 AK1~SH~247 AK2~856~2470001 AK5~A AK2~856~2470002 AK5~A... (3 Replies)
Discussion started by: isingh786
3 Replies
Login or Register to Ask a Question