Networker

Re: [Networker] Deleting client entries under /nsr/index

2004-05-04 12:50:28
Subject: Re: [Networker] Deleting client entries under /nsr/index
From: Darren Dunham <ddunham AT TAOS DOT COM>
To: NETWORKER AT LISTMAIL.TEMPLE DOT EDU
Date: Tue, 4 May 2004 09:50:14 -0700
> Does anyone have a script handy that checks for rogue index entries
> (checks the contents of the index directory against the networker client
> list?)  If so, I'd be interested in seeing that.

Handy?  No.  But give me a few seconds..  No warranty, please check it
yourself.  Most folks should have perl.

#!/bin/perl -w
use strict;

my $nsradmin = '/usr/sbin/nsradmin';
my $nsr_dir = '/nsr';

my @clients = `printf "show name\nprint type:nsr client\n" | $nsradmin -i -`;
#print "@clients";

# Examine client index directory
my $client_dir = "$nsr_dir/index";
opendir (DIR, $client_dir) or die "$0: Couldn't open $client_dir. $!\n";
while (my $client = readdir(DIR))
{
  next if ($client =~ /^\.\.?$/);
  if (exists $clients{$client})
  { delete $clients{$client}; }
  else
  { print "Client $client seen in $client_dir, but not registered.\n"; }
}

# print up any clients not seen in index directory.
foreach my $client (keys %clients)
{
  print "Client $client registered, but no index in $client_dir.\n";
}


--
Darren Dunham                                           ddunham AT taos DOT com
Senior Technical Consultant         TAOS            http://www.taos.com/
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >

--
Note: To sign off this list, send a "signoff networker" command via email
to listserv AT listmail.temple DOT edu or visit the list's Web site at
http://listmail.temple.edu/archives/networker.html where you can
also view and post messages to the list.
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=