3

Jobs with a long command-line is not printing in Solaris:

   bash-3.2$ /usr/ucb/ps auxwww | grep ftf | awk '{print $NF}' | head -5
  /proj/cmp01/app/btws/cfg/btw
  /proj/cmp01/app/btws/cfg/btw
  /proj/cmp01/app/btws/cfg/btw
  /proj/cmp01/app/btws/cfg/btw
  /proj/cmp01/app/btws/cfg/btw

  bash-3.2$ /usr/ucb/ps -alxww | grep -v "alxww" | grep ftf | grep -v grep|head -5
  0 39548   737   693  0  50 20 5112 3952 603110c3e70 S ?        249:55 /usr/bin/bash                  
  /proj/cmp01/app/ftf/bin/ftf.sh -y -c /proj/cmp01/app/btws/cfg/btw
  0 39548   906   871  0  50 20 4568 3488 6034bfbf348 S ?        245:12 /usr/bin/bash   
  /proj/cmp01/app/ftf/bin/ftf.sh -y -c /proj/cmp01/app/btws/cfg/btw
  0 39548  2512  2480  0  50 20 4552 3544 603d5120df8 S ?        134:04 /usr/bin/bash 
  /proj/cmp01/app/ftf/bin/ftf.sh -y -c /proj/cmp01/app/btws/cfg/btw
  0 39548  2523  2496  0  50 20 4728 3688 602fcee1d28 S ?        135:43 /usr/bin/bash 
  /proj/cmp01/app/ftf/bin/ftf.sh -y -c /proj/cmp01/app/btws/cfg/btw
  0 39548  2557  2535  0  50 20 4472 3480 603df1e0838 S ?        133:48 /usr/bin/bash 
  /proj/cmp01/app/ftf/bin/ftf.sh -y -c /proj/cmp01/app/btws/cfg/btw

It is chopping off part of the configuraton file.

I also cannot use pargs:

   bash-3.2$ for i in `/usr/ucb/ps -alxww | grep -v "alxww" | grep ftf | grep -v gr
   ep| awk '{print $3}'|head -3`; do pargs $i; done 
   pargs: cannot examine 737: permission denied
   pargs: cannot examine 2512: permission denied
   pargs: cannot examine 2523: permission denied
   bash-3.2$ 

I checked this question, but I couldn't get the complete arguments:

  • What do you think the full arguments look like? – Mikel Jul 01 '14 at 15:18
  • Is ps printing the pid as the second or third column? Surely you don't have five processes, all with the pid 39548? – Mikel Jul 01 '14 at 15:20
  • full arguments look like,
       `/usr/bin/bash /proj/cmp01/app/ftf/bin/ftf.sh -y -c     
       /proj/cmp01/app/btws/cfg/btws_fnhkdr.cfg
    
       /usr/bin/bash /proj/cmp01/app/ftf/bin/ftf.sh -y -c 
       /proj/cmp01/app/btws/cfg/btws_bilvim_e2e.cfg
    
       /usr/bin/bash /proj/cmp01/app/ftf/bin/ftf.sh -y -c 
       /proj/cmp01/app/btws/cfg/btws_giwsch_e2e.cfg
    
       /usr/bin/bash /proj/cmp01/app/ftf/bin/ftf.sh -y -c 
       /proj/cmp01/app/btws/cfg/btws_bilspi_e2e.cfg
    
       /usr/bin/bash /proj/cmp01/app/ftf/bin/ftf.sh -y -c     
       /proj/cmp01/app/btws/cfg/btws_cpbtdr.cfg`
    
    – Tingrammer Jul 02 '14 at 04:18
  • In the above comment, starting command is /usr/bin/bash & there are 5 records. – Tingrammer Jul 02 '14 at 04:22
  • Sorry ps is printing pid in 3rd column, updating the question – Tingrammer Jul 02 '14 at 04:25
  • Found the correct solution. When i run /usr/ucb/ps auxwww | grep ftf command in elevated user, it gave me complete ans. dcmh228z:dcmp01 $/usr/ucb/ps auxwww | grep ftf | head -2 dcmp01 807 0.1 0.0 4392 3520 ? S 18:14:31 1:24 /usr/bin/bash /proj/cmp01/app/ftf/bin/ftf.sh -y -c /proj/cmp01/app/btws/cfg/btws_wirwtx.cfg dcmp01 13075 0.0 0.0 4192 3320 ? S 19:54:01 0:00 /usr/bin/bash /proj/cmp01/app/ftf/bin/ftf.sh -y -c /proj/cmp01/app/btws/cfg/btws_wlbai.cfg – Tingrammer Jul 02 '14 at 09:55

1 Answers1

2

I believe you are making it more complex than it needs to be. No need for awk or ancient version of ps command.

Try this:

for x in `ps -ed -o pid=`; do echo -n "$x " ; pargs -l $x; done

Or when pretty printed:

for x in `ps -ed -o pid=`; do 
   echo -n "$x " 
   pargs -l $x 2>/dev/null # don't want to see err msg for procs that no longer exist
done

This will produce an output with PID and all the cmd args on one line no matter how long. Then you can grep your way through that output if you like.

Remember that pargs command needs to examine the process and you may not be allowed to do that for all processes .. unless you are root or have equivalent privs.

peterh
  • 922
  • even after using above command i m still getting the same error as above pargs: cannot examine 20570: no such process or core file – Tingrammer Jul 02 '14 at 04:17
  • This worked . Promt: $for i in /usr/ucb/ps -alxww | grep -v "alxww" | grep ftf | grep -v grep | awk '{print $3}'; do pargs $i; done 737: /usr/bin/bash /proj/cmp01/app/ftf/bin/ftf.sh -y -c /proj/cmp01/app/btws/cfg/btw argv[0]: /usr/bin/bash argv[1]: /proj/cmp01/app/ftf/bin/ftf.sh argv[2]: -y argv[3]: -c argv[4]: /proj/cmp01/app/btws/cfg/btws_wlsap.cfg – Tingrammer Jul 02 '14 at 04:38
  • Sorry couldnt format it properly. argv[4] shows complete configuration file – Tingrammer Jul 02 '14 at 04:40
  • 1
    @Tingrammer. Processes come and go. My script collects the list of PIDs first and then loops these to perform an pargs on each of them, one by one. It may happen that a process has ended in the meantime. That's why you get that error message. If you really cannot live with seeing such message then I've updated my answer so that it now doesn't display such errors. – peterh Jul 04 '14 at 10:43