UUGRN

Re: Alle Prozesse eines Users killen (perl)?

From
Mark Seuffert (Pirates) <captain@...>
Date
Heinz Diehl schrieb am 14 Jun 99, (you wrote):

> ps au, dann einfach die ID bestimmen und per system einen Kill-Befehl
> absetzen:
>
> $pid =~ s/.*?([0-9]*).*/$1/; system("kill -9 $pid");

oki danke! :)
Vielleicht ne andere RE (userame könnte Ziffern beinhalten)
und kill gibt's auch inline.

open (PROCESS, "$ps_cmd |") || die ("Error opening '$ps_cmd': $!\n");
while (<PROCESS>) {
($username,$pid) = /^(.*?)\s+(\d+)\s+.*/;
print "$username, $pid\n";
}
close PROCESS || die "Error closing '$ps_cmd': $!\n";

--
 _    _   Just do it!         _
| |  (_)_ _ _  ___ __    ~0  |_)    Mark "Moak" Seuffert
| |__| | ' \ || \ \ /   |(_~|___|   Pirates Communication
|____|_|_||_|__//_\_\    T/_ T T    http://www.pirate.de
Nihil agere delectat. Nichtstun ist angenehm. (Cicero)

Thread

In reply to: Re: Alle Prozesse eines Users killen (perl)? Heinz Diehl <hd@...>

Follow-ups: