[ale] Shell Script Question

David Tomaschik david at systemoverlord.com
Fri Aug 12 11:08:31 EDT 2011


On Fri, Aug 12, 2011 at 11:03 AM, David Tomaschik
<david at systemoverlord.com> wrote:
> On Fri, Aug 12, 2011 at 10:57 AM, Scott Steele <roninazure at gmail.com> wrote:
>> Thanks for your help so far on this, I received further clarification as
>> to what I need to do and I think it requires a little tweaking. For the
>> ones that are "state:reachable" I don't need any value returned, or
>> maybe a simple echo statement that says "reachable" or a numeric value
>> of "-1". I can change it if necessary.. For the ones that are in
>> "state:unreachable". I need a count of how many return like that. Say
>> 5,6,7, or so on.  So the output I am interested in is:
>>
>> -1 (good)
>>
>> or
>>
>> 5 (bad)
>>
>> This is the script so far that I have. For a reference point.
>>
>> #!/bin/sh
>>
>> export JAVA_HOME=/hosting/products/
>> WebSphereU01/java
>>
>> #sets the environment in java
>>
>> #the values -p -bp and -ch will need to be altered according to what
>> needs to be run.
>>
>> /hosting/ogsa/ogsa-6.1.0.5/ObjectGrid/bin/xsadmin.sh -p 26572 -bp 26570
>> -ch nc3sz2ecmus02 -routetable | sed -e 's/.*state:reachable.*/>0/' e
>> 's/.*state:unreachable.*/<0/' > `date "+%y%m%d%H%M%S"`.txt
>>
>> This is the output it produces in its current form.
>>
>>>0
>>
>>>0
>>
>>>0
>>
>> And so forth.
>>
>
> Do you need just a single value to be output?  And is it actually
> looking for output, or a return value?
>

Answering my own question (I think).  A quick search seems to indicate
that SiteScope cares about return values, not output, so you could
even do something as simple as this:

return $(/hosting/ogsa/ogsa-6.1.0.5/ObjectGrid/bin/xsadmin.sh -p 26572
-bp 26570 -ch nc3sz2ecmus02 -routetable | grep -c unreachable)



-- 
David Tomaschik, RHCE, LPIC-1
System Administrator/Open Source Advocate
OpenPGP: 0x5DEA789B
http://systemoverlord.com
david at systemoverlord.com



More information about the Ale mailing list