LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Closed Thread
 
Search this Thread
Old 03-11-2011, 10:38 PM   #1
anishkumarv
Member
 
Registered: Feb 2010
Location: chennai - India
Distribution: centos
Posts: 289

Rep: Reputation: 10
case...esac how to implement in my requirement!To find the URL status.


Hi all,

my requirement is , iam writing the bash script to monitor a url, whether its working fine or not. like that

for that using this command.
Code:
curl –connect-timeout 30 -w “totaltime:%{time_total}\n” -s -I -L http://linuxquestions.org | awk '{for(i = 1; i<=NF; i++) if($i=="“totaltime:0.000n”“totaltime:0.000n”HTTP/1.1") print $(i+1);}'
i got the error code, is it possible to write the script with the help of this code using switch case statement to find the status of the URL. if possible means please guide me.

With Thanks and Regards
Anish Kumar.V
 
Old 03-12-2011, 01:47 AM   #2
corp769
Guru
 
Registered: Apr 2005
Posts: 5,814

Rep: Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001
You got the error code? Which one? And this script doesn't work for me, you need to go through and get it to work in your understanding before I modify it and explain what you need to do.

Josh
 
Old 03-12-2011, 01:51 AM   #3
corp769
Guru
 
Registered: Apr 2005
Posts: 5,814

Rep: Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001
My fault, here you go:

http://www.linuxquestions.org/questi...or-url-866596/

Oh wait, that's YOUR thread. Stick to just one, ok? Reported to be closed.
 
Old 03-12-2011, 12:47 PM   #4
anishkumarv
Member
 
Registered: Feb 2010
Location: chennai - India
Distribution: centos
Posts: 289

Original Poster
Rep: Reputation: 10
please check this code..

Code:
curl –connect-timeout 30 -w “totaltime:%{time_total}\n” -s -I -L http://linuxquestions.org | awk '{for(i = 1; i<=NF; i++) if($i=="“totaltime:0.000n”“totaltime:0.000n”HTTP/1.1") print $(i+1);}'
OUTPUT:

301

using this error code and with the help of case statements how to write the script.


Wit Regards
Anish Kumar.V
 
Old 03-12-2011, 12:55 PM   #5
corp769
Guru
 
Registered: Apr 2005
Posts: 5,814

Rep: Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001
Quote:
Originally Posted by anishkumarv View Post
please check this code..

Code:
curl –connect-timeout 30 -w “totaltime:%{time_total}\n” -s -I -L http://linuxquestions.org | awk '{for(i = 1; i<=NF; i++) if($i=="“totaltime:0.000n”“totaltime:0.000n”HTTP/1.1") print $(i+1);}'
OUTPUT:

301

using this error code and with the help of case statements how to write the script.


Wit Regards
Anish Kumar.V
For the last time, use your other thread. Thank you for understanding.
 
Old 03-12-2011, 01:12 PM   #6
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
@anishkumarv: as already pointed out this is quite the same question in http://www.linuxquestions.org/questi...or-url-866596/. Please, stick with it. Discussion is still active there and you already got plenty of advices. Thank you.

This one closed because it is a duplicate.
 
  


Closed Thread

Tags
awk, bash, shell


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Find URL in Debian package index via awk/sed (=find a line, then search from there) maddes.b Linux - Software 11 06-28-2013 08:37 AM
case esac in shell script vadirajcs Programming 16 08-10-2011 08:43 AM
Implement status for my init.d script ashok449 Linux - General 1 07-04-2008 07:24 AM
how implement battery status on acer aspire....kernel 2.6.15.6 sarajevo Debian 3 03-24-2006 11:06 AM
i want to make a script with case.esac Alexander.s Linux - Newbie 3 12-14-2004 06:29 AM


All times are GMT -5. The time now is 12:59 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration