[TriLUG] OT - script help

Shane O'Donnell shaneodonnell at gmail.com
Fri Jul 8 14:04:46 EDT 2005


Are you doing this in bash?

If so, try:

  declare -i varname   # makes the variable an integer
  varname=`your kludgy awk/sed stuff here`  # encased in "back tics"

That will get you an integer variable that you can use for comparisons
in an if/then/else block, or however you intend to do it.

Good luck,

Shane O.

On 7/8/05, Ryan Leathers <Ryan.Leathers at globalknowledge.com> wrote:
> just convert the resulting string to an integer so you can compare to see if its larger than your threshold.
> 
> 
> -----Original Message-----
> From: trilug-bounces at trilug.org on behalf of Howard Boyd
> Sent: Fri 7/8/2005 12:52 PM
> To: trilug at trilug.org
> Subject: [TriLUG] OT - script help
> 
> Could use some help w/ a simple script problem. I have written a simple
> script that will output the following line:
> 
>    QUEUE(IN.TECH.Q)                        CURDEPTH(0)
> 
> I'm interested in the number that appears between the parentheses after
> the word CURDEPTH. This number will vary depending on the health of my
> application. I want to script something that says if this number is
> greater than 100, send an email to me.
> 
> For those who care, the number is the Queue Depth for the queue running on
> my MQ Series server. When this number is over 100, I want to be notified
> so that I can check on my application.
> 
> I can use: awk '{ print $2 ; }' curdepth.txt | sed -e 's/CURDEPTH(//' -e
> 's/)//' > number.txt to strip away all the text except for the number (and
> I'm sure there is a more elegant solution), but how do I assign this to a
> variable that I can compare to my threshold point?
> 
> Right now, I just want something functional and don't care about elegant.
> Any and all help is greatly appreciated!
> 
> Howard
> 
> **************************************************************
> * Then I realized that it is good and proper for a man to
> * eat and drink, and to find satisfaction in his toilsome
> * labor under the sun during the few days of life God has
> * given him - for this is his lot. Moreover, when God gives
> * any man wealth and possessions, and enables him to
> * enjoy them, to accept his lot and be happy in his work -
> * this is a gift of God. Ecclesiastes 5:18-19 NIV
> **************************************************************
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
> TriLUG PGP Keyring         : http://trilug.org/~chrish/trilug.asc
> 
> 
> 
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
> TriLUG PGP Keyring         : http://trilug.org/~chrish/trilug.asc
> 
> 


-- 
Shane O.
========
Shane O'Donnell
shaneodonnell at gmail.com
====================



More information about the TriLUG mailing list