version 1.119, 2019/07/18 18:28:40
|
version 1.120, 2020/01/11 21:54:31
|
Line 1096 sub write_hostips {
|
Line 1096 sub write_hostips {
|
if (keys(%prevhosts) && keys(%currhosts)) { |
if (keys(%prevhosts) && keys(%currhosts)) { |
foreach my $key (keys(%prevhosts)) { |
foreach my $key (keys(%prevhosts)) { |
unless ($currhosts{$key} eq $prevhosts{$key}) { |
unless ($currhosts{$key} eq $prevhosts{$key}) { |
$ipchange{$key} = $prevhosts{$key}.'|'.$currhosts{$key}; |
$ipchange{$key} = $prevhosts{$key}.' | '.$currhosts{$key}.' |'; |
} |
} |
} |
} |
foreach my $key (keys(%currhosts)) { |
foreach my $key (keys(%currhosts)) { |
unless ($currhosts{$key} eq $prevhosts{$key}) { |
unless ($currhosts{$key} eq $prevhosts{$key}) { |
$ipchange{$key} = $prevhosts{$key}.' | '.$currhosts{$key}; |
$ipchange{$key} = $prevhosts{$key}.' | '.$currhosts{$key}.' |'; |
} |
} |
} |
} |
} |
} |
Line 1109 sub write_hostips {
|
Line 1109 sub write_hostips {
|
if (keys(%ipchange)) { |
if (keys(%ipchange)) { |
if (open(my $fh,'>>',$perlvar{'lonDaemons'}.'/logs/hostip.log')) { |
if (open(my $fh,'>>',$perlvar{'lonDaemons'}.'/logs/hostip.log')) { |
print $fh "********************\n".localtime(time).' Changes --'."\n". |
print $fh "********************\n".localtime(time).' Changes --'."\n". |
"Hostname | Previous IP | New IP\n". |
"Hostname | Previous IP | New IP |\n". |
"--------------------------------\n"; |
"--------------------------------\n"; |
foreach my $hostname (sort(keys(%ipchange))) { |
foreach my $hostname (sort(keys(%ipchange))) { |
print $fh "$hostname | $ipchange{$hostname}\n"; |
print $fh "$hostname | $ipchange{$hostname}\n"; |
Line 1127 sub write_hostips {
|
Line 1127 sub write_hostips {
|
"MIME-Version: 1.0\n\n". |
"MIME-Version: 1.0\n\n". |
"Host/IP changes\n". |
"Host/IP changes\n". |
" \n". |
" \n". |
"Hostname | Previous IP | New IP\n". |
"Hostname | Previous IP | New IP |\n". |
"--------------------------------\n"; |
"--------------------------------\n"; |
foreach my $hostname (sort(keys(%ipchange))) { |
foreach my $hostname (sort(keys(%ipchange))) { |
$chgmail .= "$hostname | $ipchange{$hostname}\n"; |
$chgmail .= "$hostname | $ipchange{$hostname}\n"; |