A ps problem with BBX

Someone recently asked me about increasing command width for 'ps' on SCO Unix. I thought I had the answer at Best of CUSM: width of command in ps, but it turns out that post was incorrect as a more recent newsgroup discussion explained. The SCO 'ps' is stuck at 80 characters.

The actual problem related to BBX. Apparently this gets run with very long command lines, but the part this person wanted to know about is at the end of the line - way out of the 80 character limit ps has here.


Hate these ads?

My immediate thought was to front-end BBX with a program that would capture the arguments and store them somewhere convenient. In Perl, that might look something like this:



#!/usr/bin/perl
$args=join '-',reverse @ARGV;
# just for more convenience
if ($pid = fork) {
  open(O,">pid.$pid");
  print O "$args\n";
 close O;
 waitpid($pid,0);
 unlink "pid.$pid";
} else {
  sleep 3600;
  # actually here you'd exec the real program, 
  # this is just a concept script
  exit 0;
}


If you wanted to be even fancier and not use a file, you could fork off yet another program with more convenient arguments:



exec 'bbxmatcher', $pid, $args;


That bbxmatcher would do nothing but sleep; you'd kill it off when the real bbx returned. Then a "ps -e | grep bbx" would display just what you wanted - perhaps sometimes slightly out of order, but often not, and easily identifiable.

You'd end up being able to do something like this:








$ ./bbx args args args args args args args args SOMEPROG &



$ ps -e | grep bbx
 8970  p2  S+     0:00.02 /usr/bin/perl ./bbxmatcher 8971 SOMEPROG-args-args-ar
 8971  p2  S+     0:00.00 /usr/bin/perl ./bbx args args args args args args arg


The "bbxmatcher" tells us that the ending argument of pid 8971 was "SOMEPROG", and could tell us other things too, if we wanted.

For production use there's probably a bit more you'd want to do, but this is the basic concept. I don't know if this meets the original person's needs, but maybe it could be used in other situations. You could arrange the arguments however you like, add extra information in more convenient formats and so on. Could be helpful for someone..


Technorati tags:

Comments /Unixart/save_ps_arguments.html


Add your comments

LOD Communications, Inc.

Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)

Or use any RSS reader

Delivered by FeedBurner


Views for this page
Today This Week This Month This Year  Overall
31912495 1,268

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

pavatar.jpg
More:
       - Perl
       - Programming
       - Kernel/Internals




Unix/Linux Consultants

Your ad here - $24.00 yearly!

http://bcstechnology.net Full service Linux & UNIX systems integrator; Windows to UNIX/Linux Client-Server Specialist; Secure E-Mail & Website Hosting; Thoroughbred Software Developer; Custom Industrial Automation; Hardware & Electronics Experts; In Business Since 1985.


http://www.m3ipinc.com Security, firewalls, ids, audits, vulnerability assesments, BS7799, HIPAA, GLB, incident handling


http://www.cleverminds.net Need expert advice? Want a second opinion? CleverMinds is a one-stop-shop for a wide range of technology solutions. We support Unix, Linux, SCO as well as CMS, ecom, blogs, podcasts, search engines consulting and more. Contact us at web2.0@cleverminds.net 0r (617) 894-1282




Twitter
  • Jun 26 21:28
    Lost 5 cents at poker tonight. Hard to do with 10 and 20 cent betting..
  • Jun 23 07:01
    Hypermiling:









Change Congress

Related Posts