mnis2008
asked on
Script Error on AIX
When I run the below command, The output is below
$ sudo /admin/bin/rsh aixdev21 lslpp -l |grep splunk
aixdev21:
splunk.db2.rte 2.2.3.2 COMMITTED SPLUNK v2 Client
So Splunk is a customized tool in our environment, I am planning to get an output of splunk versions across the environment and I am expecting the output to be
- HOSTNAME SPLUNK-VERSION OSLEVEL
So I went ahead and wrote a script
########################## ########## ########## ######
for i in `cat $SERVER_LIST`
do
ping -c 2 -w 1 $i >> /dev/null
if [ $? -eq 1 ]; then
echo "$i did not respond"
else
SPLUNK = `sudo /admin/bin/rsh $i "lslpp -l|grep splunk" | grep Client | grep -v $i | awk '{print $2}'`
OSLEVEL = `sudo /admin/bin/rsh $i "OSLEVEL = `oslevel -s`"`
echo "$i $SPLUNK $OSLEVEL"
fi
exit 0
########################## ########## ########## ########## ####
But I am getting an error running, The error is ksh cannot identify SPLUNK and OSLEVEL...
So can someone help me with the script...
Thanks
Steve
$ sudo /admin/bin/rsh aixdev21 lslpp -l |grep splunk
aixdev21:
splunk.db2.rte 2.2.3.2 COMMITTED SPLUNK v2 Client
So Splunk is a customized tool in our environment, I am planning to get an output of splunk versions across the environment and I am expecting the output to be
- HOSTNAME SPLUNK-VERSION OSLEVEL
So I went ahead and wrote a script
##########################
for i in `cat $SERVER_LIST`
do
ping -c 2 -w 1 $i >> /dev/null
if [ $? -eq 1 ]; then
echo "$i did not respond"
else
SPLUNK = `sudo /admin/bin/rsh $i "lslpp -l|grep splunk" | grep Client | grep -v $i | awk '{print $2}'`
OSLEVEL = `sudo /admin/bin/rsh $i "OSLEVEL = `oslevel -s`"`
echo "$i $SPLUNK $OSLEVEL"
fi
exit 0
##########################
But I am getting an error running, The error is ksh cannot identify SPLUNK and OSLEVEL...
So can someone help me with the script...
Thanks
Steve
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The commands as posted in my last comment should work just fine.
What is the output if you don't capture it in a variable?
i=myhost
sudo /admin/bin/rsh $i "lslpp -l|grep splunk" | grep Client | grep -v $i | awk '{print $2}'
and
i=myhost
sudo /admin/bin/rsh $i oslevel -s
Is your rsh indeed in /admin/bin ? Is this a special setup for sudo?
What is the output if you don't capture it in a variable?
i=myhost
sudo /admin/bin/rsh $i "lslpp -l|grep splunk" | grep Client | grep -v $i | awk '{print $2}'
and
i=myhost
sudo /admin/bin/rsh $i oslevel -s
Is your rsh indeed in /admin/bin ? Is this a special setup for sudo?
ASKER
Sorry it worked...
ASKER