#!/usr/bin/perl
use strict;
sub main
{
my @lines = `ps教程
my $users;
for my $line (@lines) {
if(my ($user
next if($user eq ‘root’);
my $proc = {‘pid’
push @{$users
}
}
for my $key(keys(%$users)) {
my @sshs = sort {
my ($lb
if($lb == $la) {
$b
} else {
$lb <=> $la;
}
} @{$users
for (
for my $ssh (@sshs) {
kill
}
}
}
while(
main;
sleep
}
From:http://tw.wingwit.com/Article/program/Java/gj/201404/30500.html