echo "selall;info;wait;infolog" | /usr/sbin/cstm problem


 
Thread Tools Search this Thread
Operating Systems HP-UX echo "selall;info;wait;infolog" | /usr/sbin/cstm problem
# 1  
Old 05-02-2011
echo "selall;info;wait;infolog" | /usr/sbin/cstm problem

Hello,

On a HP-UX 10.20 server I've executed something similar to this command:

Code:
# echo 'selall;info;wait;infolog;view;done' | /usr/sbin/cstm

But it returns sometype of "argument list too long" error.

I suppose there is a way to fix it by using xargs but I can't figure it out.

Any ideas related to this?

Thank you.

Last edited by joeyg; 05-02-2011 at 12:22 PM.. Reason: Please use CodeTags around commands.
# 2  
Old 05-03-2011
I dont see anything wrong with the command... but as yousay you executed something similar, I would suggest you give us more information like the output of
Code:
uname -a

and the exact command line you passed with its output...
# 3  
Old 05-04-2011
Code:
> uname -a
HP-UX instruc B.10.20 A 9000/800 810357402 two-user license
>

To reproduce the error, I have a script to check deconfigured memory and other things.
So, in a part of the script I execute these lines:

Code:
CSTM=`$_echo "selall;info;wait;infolog" | /usr/sbin/cstm`
 if [ `echo "$CSTM" | grep -c "(SelAll) is currently disabled."` -gt 0 ]; then
...

And I get:

Code:
/bin/echo: arg list too long

Thank you.
# 4  
Old 05-04-2011
This is a scripting error and not a cstm error.
On my system the cstm command posted outputs more than 3000 words, and you are dumping the entire formatted output from cstm into an environment variable called $CSTM. Quite easy to exceed the maximum size allowed in "echo" on older systems.
What Shell are you using?
Code:
echo $SHELL

No idea what $_echo is about in your script.

I think we can simplify the script down to:
Code:
HIT_COUNT=`echo "selall;info;wait;infolog" | /usr/sbin/cstm | grep -c "(SelAll) is currently disabled."`
if [ ${HIT_COUNT} -gt 0 ]; then
echo "HIT_COUNT is ${HIT_COUNT}"
fi


By the way I've never seen this exact string in a cstm report:
Quote:
"(SelAll) is currently disabled."
# 5  
Old 05-04-2011
To know what model your server is you can type
Code:
model

...
What shell are you using since I dont understand quite well your syntax to initialize CSTM variable, I would do this:
Code:
civ:/home/vbe $ export CSTM=$(echo "selall;info;wait;infolog" | /usr/sbin/cstm)
civ:/home/vbe $ echo "$CSTM" | grep -c "selall"                                
1
civ:/home/vbe $

# 6  
Old 05-06-2011
Code:
instruc:/> echo $SHELL
/sbin/sh
instruc:/> model
9000/800/K580
instruc:/>

The $_echo thing is an error. I have this on the script:

Code:
CSTM=`echo "selall;info;wait;infolog" | /usr/sbin/cstm`  
if [ `echo "$CSTM" | grep -c "(SelAll) is currently disabled."` -gt 0 ]; then

And it reports:
Code:
/bin/echo: arg list too long

Thanks
# 7  
Old 05-06-2011
Please read my post #4.
Environment variables are not files. Line breaks are not preserved. The "cstm" program output is somewhat verbose. $CSTM will just contain a lot of words with no line structure.
You are giving "echo" a single very long line. Or rather more importantly the "if" line becomes very long.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Mindboggling difference between using "tee" and "/usr/bin/tee" in bash

I'm on Ubuntu 14.04 and I manually updated my coreutils so that "tee" is now on version 8.27 I was running a script using bash where there is some write to pipe error at some point causing the tee command to exit abruptly while the script continues to run. The newer version of tee seems to prevent... (2 Replies)
Discussion started by: stompadon
2 Replies

2. Red Hat

"/usr/sbin/hpacucli ctrl all show" command does not work

Dear Concern, We have observed that following command stuck/does not work in some RedHat nodes. Please advise us to troubleshoot the issue. /usr/sbin/hpacucli ctrl all show Note: HP Array Configuration Utility CLI for Linux 64-bit With Best Regards, Md. Abdullah-Al Kauser (3 Replies)
Discussion started by: makauser
3 Replies

3. UNIX for Advanced & Expert Users

AIX - io info get from "libperfstat" not match "iostat"

Hi, everyone. I need to write a program to get io info based on libperfstat. But the "write time" of a disk is just half of the value get from iostat. I'm confused and can't explain. Help please. How I calculate "write service time per sec": In iostat: write service... (0 Replies)
Discussion started by: jackliang
0 Replies

4. Shell Programming and Scripting

If cmd in in "A/user/bin A/bin A/user/sbin" but not "B/user/bin B/bin B/user/sbin" directory print t

there are two directories A and B if cmd in in "A/user/bin A/bin A/user/sbin" but not "B/user/bin B/bin B/user/sbin" directory print them (1 Reply)
Discussion started by: yanglei_fage
1 Replies

5. Shell Programming and Scripting

About reture with string and keep other "echo" info

I use below code to get ip, and I want to echo something in the function, but the $IP will be all the value from "echo" I just want to get the real ip, and keep the echo info, any help #!/bin/bash get_ip() { ip=$(grep -B2 "00:01:02:03:04:05" ip_tmp.log |head -1 |awk '{print $2}') ... (4 Replies)
Discussion started by: yanglei_fage
4 Replies

6. Shell Programming and Scripting

tcsh - understanding difference between "echo string" and "echo string > /dev/stdout"

I came across and unexpected behavior with redirections in tcsh. I know, csh is not best for redirections, but I'd like to understand what is happening here. I have following script (called out_to_streams.csh): #!/bin/tcsh -f echo Redirected to STDOUT > /dev/stdout echo Redirected to... (2 Replies)
Discussion started by: marcink
2 Replies

7. Solaris

The slices "usr", "opt", "tmp" disappeared!!! Help please.

The system don't boot. on the screen appears following: press enter to maintenance (or type CTRL-D to continue)...I checked with format command. ... the slices "0-root","1-swap","2-backup" exist. ...the slises "3-var","6-usr" -unassigned. :( (16 Replies)
Discussion started by: wolfgang
16 Replies

8. AIX

echo $varibla | mail -s "subject" "xxx@xxx.com" not ruuning as expected

Hi Folks, As per the subject, the following command is not working as expected. echo $variable | mail -s "subject" "xxx@xxx.com" Could anyone figure it out whats wrong with this. I am using AIX box. Regards, (2 Replies)
Discussion started by: gjarms
2 Replies

9. Shell Programming and Scripting

calling a shell script in background and wait using "wait" in while loop

Hi, I am facing a strange issue, when i call a script from my while loop in background it doesnt go in background, despite the wait i put below the whil loop it goes forward even before the process put in background is completed. cat abc.txt | while read -u4 line do #if line contains #... (2 Replies)
Discussion started by: mihirvora16
2 Replies

10. Solaris

difference between "root" and "usr" packages

Hi, could someone pls enlighten me on the difference between the "root" package and "usr" package? Like in this example: pkginfo -l SUNWGtku | grep -i desc DESC: GTK - The GIMP Toolkit (Usr) and pkginfo -l SUNWGtkr | grep -i desc DESC: GTK - The GIMP Toolkit (Root)... (6 Replies)
Discussion started by: masloff
6 Replies
Login or Register to Ask a Question