Re: oaf-slay improvements



Dan:

Regarding your comments:

> > if ($uname eq "SunOS") {
> >       $username = `/usr/ucb/whoami`;
> > } else {
> >       $username = `/usr/bin/whoami`;
> > }
> 
> That should really be done with a configure check (AC_PATH_PROG or
> something).

That would obviously be preferable.  I'm not familiar with setting up
configure scripts, so I hope someone else could take care of this.

> > $ps_cmd = "/bin/ps -e -opid,user,args | /bin/grep ".$username;
> 
> and that assumes a SVR4-style ps. Is there some perl module that can be
> used for process listing stuff instead?

I'm not aware of any standard Perl module that shelters Perl users from
the "ps" command.  I've typically seen Perl programs deal with this
by checking uname and building the appropriate ps command.  I tested
the script I provided on Solaris and Linux and it works okay.  Someone
will likely need to hack it a bit to get it to work on BSD, but that
should be just a little work.

If there is a standard Perl module that can be used, point me towards it
and I'll happily update the script to use it.

At any rate, this is *much* more efficient than using pkill.  Not sure
if you've played with the script I provided but it runs with no noticable
delay.  The old oaf-slay can take 6-7 seconds to complete on a single
user machine, and much longer on a multi-user machine.  We've seen
oaf-slay churn for as long as 20-30 seconds on machines with hundreds
of users.

Brian





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]