in reply to Capture Console Results?
My mac lets me specify ps -auwwx which will show you the ENTIRE command line for every process. Note, just one 'w' just gives you a 'standard wide' width result list, the extra 'w' goes the extra mile. But if you man ps on your mac, you'll see:
... -w Use 132 columns to display information, instead of the de +fault which is your window size. If the -w option is specified + more than once, ps will use as many columns as necessary witho +ut regard for your window size. ...
... this will also work on Linux (if you drop the preceeding '-' to the auwwx) and FreeBSD. Though I think I like the "pure perl" solution a bit better.
Update: I made some changes to your open and your split to make sure I wasn't leading you astray. Note that the command is "ps -auwwx" as opposed to "ps - aux" (please notice the space I have omitted) plus I'm throwing away all the rest of the bits of the results I don't care about. Also note that there are more columns returned with the modification of ps
open(PS_F, "ps -auwwx | grep inder |") || die "Can't open console\n"; while (<PS_F>) { (undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,$comm +,$comm1,$comm2) = split; $comm .= ' '.$comm1.' '.$comm2; if($comm =~ m/Theservice.pl /i) { print "Service Already Running\n"; } print $comm, "\n"; } close(PS_F);
Since I don't have Theservice.pl running, I'm grepping for "inder"... the output is:
$ perl ps.pl /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder -psn_0_9 +17505 sh -c ps grep inder
HTH
$/ = q#(\w)# ; sub sig { print scalar reverse join ' ', @_ } + sig map { s$\$/\$/$\$2\$1$g && $_ } split( ' ', ",erckha rlPe erthnoa stJu +" );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Capture Console Results?
by acid06 (Friar) on Feb 25, 2006 at 00:58 UTC | |
by chargrill (Parson) on Feb 25, 2006 at 06:51 UTC | |
by ecuguru (Monk) on Feb 26, 2006 at 05:36 UTC | |
|
Re^2: Capture Console Results?
by ecuguru (Monk) on Feb 26, 2006 at 05:35 UTC | |
by ecuguru (Monk) on Feb 26, 2006 at 05:58 UTC | |
by chargrill (Parson) on Feb 26, 2006 at 18:22 UTC | |
by ecuguru (Monk) on Mar 14, 2006 at 00:10 UTC |