Sponsored Content
Full Discussion: Shell script guru
Top Forums Shell Programming and Scripting Shell script guru Post 302869005 by Zach Kadiwal on Tuesday 29th of October 2013 12:57:57 PM
Old 10-29-2013
Scissors Shell script guru

Hey Gurus,
Need help to modify the shell script. I am really new in the Linux/Unix world and dont familiar with shell scripting. SO bascially my script is running a ( curl ) with some endpoints and returning HTTP status code.
Now i have a 50 different endpoints and cant make each and individual file for those endpoints. So now i am thinking to pass the CURL as argument. I have tried so many things but didnt work. please gurus help me to figure it out this.
MY SCRIPT

Code:
#!/bin/sh

#### Errors ####
#200X   OK
#300X   WARNING
#400X   WARNING
#500X   CRITICAL
#Else   UNKNONE
################

#Set Email
EMAIL=""


OUT_STATUS="500"


OUT_MSG="$(curl -H "Accept: application/json" -H "Content-Type: application/json" -H "X-Auth-Token: 0c90cc08f56140a3be7217c40731e0fe" \
-X GET -I http://10.5.178.164/5822710/events/2ba0a7f3-74e2-406c-8292-710f9cc4e20d 2> /dev/null | grep '^HTTP')"


OUT_STATUS="$(echo ${OUT_MSG} | awk '{print $2}')"


if [ "${OUT_STATUS}" -ge "200" ] && [ "${OUT_STATUS}" -lt "300" ]; then
  echo "OK - ${OUT_MSG}"
  exit 0
elif [ "${OUT_STATUS}" -ge "300" ] && [ "${OUT_STATUS}" -lt "500" ]; then
  echo "WARNING - ${OUT_MSG}"
  exit 1
elif [ "${OUT_STATUS}" -ge "500" ] && [ "${OUT_STATUS}" -lt "600" ]; then
  echo "CRITICAL - ${OUT_MSG}"
  exit 2
else
  echo "UNKNONE - ${OUT_MSG}"
  exit 3
fi


Last edited by vbe; 10-29-2013 at 02:10 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Perl Guru help

I am trying to install Perl 5.005 on solaris 2.5, following the perl installation guide in INSTALL file that comes with Perl software However, according to the installation procedure, it instruct me to to excute "make" command after running the Configure which I did but everytime I excute... (3 Replies)
Discussion started by: hassan2
3 Replies

2. UNIX for Advanced & Expert Users

sun guru help!

I installed sun recommended cluster patches for solaris 2.5 on my solaris 2.5 server and then issued a shutdown -i6 -y -g0 to reboot the server but server failed to come back up. the server tries to boot up and goes through initialising memory then server freeze. I try to bring the server up... (7 Replies)
Discussion started by: hassan2
7 Replies

3. UNIX for Advanced & Expert Users

what do most Unix guru's use ? :D

I wanted to know what email app most Sun solaris / unix gurus use ? I have become quite NON microsoft in the last few months in my studying solaris.. thanks simon2000 (6 Replies)
Discussion started by: simon2000
6 Replies

4. UNIX for Dummies Questions & Answers

To all the Java guru...

Please forgive me if this is the wrong place for this post. I didn't see a good place to post this topic in. :D I would like to know what's the most popular and reliable Java IDE out there nowadays? A FREE one would be awesome! :D Thanks for your suggestion! Cheers! (10 Replies)
Discussion started by: laila63
10 Replies

5. UNIX for Advanced & Expert Users

TAR prob - Guru's please help

I'm trying to tar 3000 files into a single tar file to be extracted on another server. Command I'm using: find . -name '*cost*' -print| xargs tar -cvf mylist.tar (Note tar is contained on filesystem not tape drive which is what I want) Above command works fine and displays all 3000+ file... (3 Replies)
Discussion started by: budrito
3 Replies

6. Shell Programming and Scripting

UNIX script issues - Plse help guru's

Hi, I have written the following UNIX for HP-UX 11i. The script basically checks for files older then 45mins in 2 repective directories and then sends and email to the administrator about them. Problem with the script is that I can run it from the command line and crontabtab but 80% of the... (2 Replies)
Discussion started by: budrito
2 Replies

7. AIX

-- Need help from a AIX guru --

Hi alls I don't see any solution and I need to have feedback from other people... On a test machine (AIX 5.1) I've installed OpenSSH software on it (with openssl, prng, etc...) like is described on IBM AIX Docs. To control the installation I've rebooted the machine and all was ok (CDE was... (15 Replies)
Discussion started by: nymus7
15 Replies

8. Shell Programming and Scripting

New PERL guru's help on strict.pm

I opened strict.pm and found some not understandable stuff, please let me know if you have any Idea on the same. 1) Line 23 => $bits |= (what is $= here how it affect the statement) 2) Line 36 => $^H (what is that I haven't found any statement on this in google) 3) Line 41 =>... (3 Replies)
Discussion started by: jatanig
3 Replies

9. What is on Your Mind?

Noob and Guru

A long time ago, my computer crashed, at that time, I was using Windows98, but because I was a noob at computers, my friend recommended me apro to fix it for me.   He came, saw the computer, and asked if I had a backup/installation disk for Windows 98. I said no.   He thought about it for a... (1 Reply)
Discussion started by: vistastar
1 Replies

10. Shell Programming and Scripting

Need help from a C++ makefile guru

hello, i'm recompiling some c++ code for OSX and there are some bugs as the configure is not picking up some libs like atlas, pastix, etc, it should be finding either in standard path or with pkgconfig but it's not so i'm rewriting the Makefile. C++ territory is a bit of a stretch with all of... (0 Replies)
Discussion started by: f77hack
0 Replies
script(1)							   User Commands							 script(1)

NAME
script - make record of a terminal session SYNOPSIS
script [-a] [filename] DESCRIPTION
The script utility makes a record of everything printed on your screen. The record is written to filename. If no file name is given, the record is saved in the file typescript. See WARNINGS. The script command forks and creates a sub-shell, according to the value of $SHELL, and records the text from this session. The script ends when the forked shell exits or when Control-d is typed. OPTIONS
The following option is supported: -a Appends the session record to filename, rather than overwriting it. NOTES
script places everything that appears on the screen in filename, including prompts. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |Enabled | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) WARNINGS
script can pose a security risk when used in directories that are writable by other users (for example, /tmp), especially when run by a privileged user, that is, root. Be sure that typescript is not a link before running script. SunOS 5.10 30 Jan 2004 script(1)
All times are GMT -4. The time now is 09:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy