summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2005-09-02 17:28:28 +0000
committerweasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede>2005-09-02 17:28:28 +0000
commit9094c77fd1c365a325d4d44a6ce59cbd90f95762 (patch)
treedebe5ca7ee1e942cfb738d383a355fab9f0b91ac
parent1814879b75005e94ec796d74644f1cec0117b8b0 (diff)
Make a pid hash, not an array. now pids are only printed once
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@13 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
-rwxr-xr-xnagios-check-libs4
1 files changed, 2 insertions, 2 deletions
diff --git a/nagios-check-libs b/nagios-check-libs
index f38fcbc..de5c138 100755
--- a/nagios-check-libs
+++ b/nagios-check-libs
@@ -50,7 +50,7 @@ my %processes;
sub getPIDs($$) {
my ($user, $process) = @_;
- return join(', ', sort @{ $processes{$user}->{$process} });
+ return join(', ', sort keys %{ $processes{$user}->{$process} });
};
sub getProcs($) {
my ($user) = @_;
@@ -76,7 +76,7 @@ for my $line (@lsof) {
if ($line =~ m/path inode=/) {
my ($process, $pid, $user, $rest) = split /\s+/, $line;
#$processes{$user}->{$process} = [] unless defined $processes{$user}->{$process};
- push @{ $processes{$user}->{$process} }, $pid;
+ $processes{$user}->{$process}->{$pid} = 1;
};
};