Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- use Net::LDAP;
- use feature 'say';
- use POSIX qw(strftime);
- use strict;
- use warnings;
- my $user = '';
- my $pass = '';
- my $strftime_format = "%m/%d/%Y %H:%M:%S";
- my @servers = ('dc01', 'dc02', 'dc03', 'dc04');
- while(1) {
- foreach my $server (@servers) {
- print strftime($strftime_format, localtime) . " Connecting to $server\n";
- my $ldap = Net::LDAP->new($server) or die "$@";
- my $bind_result = $ldap->bind($user, password => $pass);
- print strftime($strftime_format, localtime) . ' ' . $bind_result->{errorMessage} . "\n" if $bind_result->{resultCode} != 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement