- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Getting "argument expected" error while runnin...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2011 03:24 AM
10-10-2011 03:24 AM
Hi Experts,
Below is my script to check the agent daemon health and its failing with "argument expected" error as given below.
shcscp18:/clocal/cschpov/user/t1982ra $ cat /tmp/test.sh for server in `cat /tmp/test.txt` do echo "Checking the agent health on $server" if [ `sudo /opt/OV/bin/OpC/opcragt $server | egrep 'ovbbccb|ovconfd|coda|opcmsga|opcacta|opcmsgi|opcle|opcmona' | awk '{print $(NF-1)}' | grep "isn't" | uniq` = "isn't" ] then echo "$server has some of the agents in not running state" >> /tmp/problematic_servers.txt else echo "$server is ok" fi done shcscp18:/clocal/cschpov/user/t1982ra $ sudo /tmp/test.sh Checking the agent health on odxgdd01.oddc.chrysler.com /tmp/test.sh: test: argument expected
shcscp18:/clocal/cschpov/user/t1982ra $ cat /tmp/test.txt
odxgdd01.oddc.chrysler.com
odxgqa05.oddc.chrysler.com
odi005nimp01.oddc.chrysler.com
avibvp1osv.bvap.chrysler.com
shcscp18:/clocal/cschpov/user/t1982ra $ sudo /opt/OV/bin/OpC/opcragt odxgdd01.oddc.chrysler.com
Node odxgdd01.oddc.chrysler.com:
OVO Managed Node status :
-------------------------
OV Control ovcd (438374) is running
OV Performance Core coda (270372) is running
OV Communication Broker ovbbccb (368704) is running
OV Config and Deploy ovconfd (348384) is running
Subagent EA:
Action Agent opcacta (401518) is running
Logfile Encapsulator opcle (413710) is running
Monitor Agent opcmona (356456) is running
Message Agent opcmsga (426214) is running
Message Interceptor opcmsgi (430314) is running
Done.
Please suggest what needs to be done to fix the error.
Thanks,
Ramkumar A.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2011 09:12 AM - edited 10-10-2011 09:18 AM
10-10-2011 09:12 AM - edited 10-10-2011 09:18 AM
Solution>for server in `cat /tmp/test.txt`; do
No need for cats: for server in $(< /tmp/test.txt); do
>/tmp/test.sh: test: argument expected
This probably means your if is bad, missing quotes:
if [ `sudo /opt/OV/bin/OpC/opcragt $server | egrep 'ovbbccb|ovconfd|coda|opcmsga|opcacta|opcmsgi|opcle|opcmona' | awk '{print $(NF-1)}' | grep "isn't" | uniq` = "isn't" ]
I would suggest you break this up into two and no need for egrep hammer:
result=$(sudo /opt/OV/bin/OpC/opcragt $server | grep "isn't" | \
grep -e ovbbccb -e ovconfd -e coda -e opcmsga -e opcacta -e opcmsgi -e opcle -e opcmona | awk '{print $(NF-1)}' | uniq)
if [ "$result" = "isn't" ]; then
But your immediate problem is the fact that your command didn't return anything and you'll need to quote it, if empty.
You can also remove the uniq(1) and just see if there is a "isn't":
sudo /opt/OV/bin/OpC/opcragt $server |
grep -e ovbbccb -e ovconfd -e coda -e opcmsga -e opcacta -e opcmsgi -e opcle -e opcmona |
awk '{print $(NF-1)}' | grep -q "isn't"
if [ $? -eq 0 ]; then