setproctitle under Solaris 7
Fletcher Mattox
fletcher at cs.utexas.edu
Sat Mar 18 02:59:12 UTC 2000
Per Hedeland wrote:
> To see argv modifications on Solaris, you need to a) use /usr/ucb/ps
> (seems you already are), and b) include at least one 'w' in the ps
> options. Yes, it's broken, don't believe the man page... Your 'grep
> nnrp' won't find anything once you include a 'w' though, and the output
> looks like sh*t.
Here's a little script which addresses these problems.
#!/usr/bin/perl
# INN's setproctitle doesn't work well in Solaris 7.
# This script tries to make it look better.
open(PGREP, 'pgrep nnrpd |');
while ( <PGREP> ) {
chop;
push(@pids,$_);
$cnt++
}
close(PGREP);
exit unless @pids;
open(PS, '/usr/ucb/ps augxww |');
while ( <PS> ) {
print if /^USER/;;
$line = $_;
@A = split(' ',$_);
for $pid ( @pids ) {
if ($pid eq $A[1]) {
$line =~ s/\.cs.utexas.edu//;
$line =~ s/ .*//;
print $line;
$cnt--;
}
}
}
close(PS);
print STDERR qq|Ooops, take a look at PID: @pids\n| if $cnt;
More information about the inn-workers
mailing list