APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

A ps problem with BBX

Someone recently asked me about increasing command width for 'ps' on SCO Unix.

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.

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:

$args=join '-',reverse @ARGV;
# just for more convenience
if ($pid = fork) {
  print O "$args\n";
 close O;
 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..

By the way, you can get BBX for Linux..

Got something to add? Send me email.

Increase ad revenue 50-250% with Ezoic

More Articles by

Find me on Google+

© Anthony Lawrence

Kerio Samepage

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.

Contact us

May you live long enough to regret your opinions - (Tony Lawrence)

Keeping URIs so that they will still be around in 2, 20 or 200 or even 2000 years is clearly not as simple as it sounds ... However, all over the Web, webmasters are making decisions which will make it really difficult for themselves in the future. (Tim Berners-Lee)

This post tagged: