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.
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..
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.
Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.
Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.
We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.
Click here to add your comments
Don't miss responses! Subscribe to Comments by RSS or by Email
Click here to add your comments
If you want a picture to show with your comment, go get a Gravatar