ps output truncated

Hi!

I have some shell scripts receiving in input lots of parameters and I need to select the ones having a particular value in one parameter.

A typical shell command line is:

PROMPT > shell_name.ksh -avalue_a -bvalue_b -cvalue_c -dvalue_d ...

I used a combinaton of ps and grep commands to select the right process, for instance:

PROMPT > ps -fu $LOGNAME | grep "shell_name\.ksh.*-dvalue_d" | grep -v grep

PROBLEM: if command line is too long, ps command extracts a part of it only (for instance till -cvalue_c), so grep command fails.

Consider that shell_name.ksh supports input parameters commutation, but I can't force shell users to launch script with -d parameter in first position.

FROM PGREP MAN:

SEE ALSO
kill(1), proc(1), ps(1), truss(1), kill(2), proc(4), attri-
butes(5), regex(5), signal(5)

NOTES
Both utilities match the ERE pattern argument against either
the pr_fname or pr_psargs fields of the /proc/nnnnn/psinfo
files. The lengths of these strings are limited according to
definitions in <sys/procfs.h>. Patterns which can match
strings longer than the current limits may fail to match the
intended set of processes.

So, maybe I have to use other commands. Have you got any ideas to select processes with long command-line?

Many thanks. Bye

Paride

What is the OS and version?

In Solaris there is a second ps command in /usr/ucb - it has different options than the normal ps command

Normal:
$ ps -ef
UCB:
$ /usr/ucb/ps -auxw

Using the other command might help (if you have it on your OS).

And please don't post the same question twice - if you have more information, post a relpy to your question. I'm going to link your other question to this.

i think you are running up against the 80 char max for line length... because your window is typically set to 80 chars

If you use the -x option it will extend your commandline for the process in question.

Here is a sample from one of my boxes.

host-root:/root/LVMcommands
# ps -aef |grep 12770
root 14462 23682 1 13:11:45 pts/td 0:00 grep 12770
applmgr 12770 12536 0 Jun 6 ? 0:17 FNDCRM APPS/879E9496000000000000
0000000000000000000000000000000
host-root:/root/LVMcommands
# ps -aefx |grep 12770
root 14476 23682 1 13:11:49 pts/td 0:00 grep 12770
applmgr 12770 12536 0 Jun 6 ? 0:17 FNDCRM APPS/879E9496000000000000
0000000000000000000000000000000000000000 FND FNDCRM N 10 c LOCK Y host1 2552

Hi,

I've nearly the same problem, but when I use
ps -ef
I can see the complete anem of the process I like to kill e.g:

ps -ef

bensk 11870 1 0 14:24 pts/5 00:00:00 /opt/blahhhhhhhhhhhhhhh/bluuuuuuuub/out

If I now grep for this process

ps -ef | grep out | grep -v out --> typo, what I did for sure:
ps -ef | grep out | grep -v grep --> -v grep for avoiding grep will find its own process

I get no results. When I grep for the process number i detetced before I get the following:

ps -ef| grep 11870

bensk 11870 1 0 14:24 pts/5 00:00:00 /opt/blahhhhhhhhhhhhhhh

So I think it is a problem of grep, but I do not know how to solve this...
Please help...

THX

ben Sky

You are telling it to grep for "out" and then telling it to remove any line that contains "out" - read the man page for grep.

typo!!

For sure i did not grep if -v for my process...
I corrected it...