I have a little routine where I read in a text file full of workstations or servers to perform some kinda of action on. Maybe copy a file, create a directory, etc. So I started thinking about trying to improve on it a little. For example: If I have five thousand workstations that I have to copy a file to I know I can use the File::Copy module and read in my list of wks's and copy the file to each machine one by one. But what if I could copy say in increments of 10 or 15 wks's at a time. That would increase the speed of this routine. I don't really know where to start. Could someone point me in the right direction. Here is my normal routine.
use File::Copy;
use Net:ing;
my $host = Net:ing->new("icmp");
##### Open logfiles for input and Read in machines to be tested #####
open (COPIED_FILE, ">>Copied_FIle.log");
open (UNREACHABLE, ">>UnReachable.log");
open (WKS, "<d:All_Workstations.log") || die ("Cannot open All_Workstations.log: $!");
while(<WKS>) {
chomp $_;
$_ =~ tr/a-z/A-Z/;
if ($host->ping($_, 5)){©_DATA}
else {
print "$_ unreachable\n";
print UNREACHABLE ("$_\n")
}
}
close COPIED_FILE;
close UNREACHABLE;
close WKS;
$host->close();
sub COPY_DATA {
copy("blah.txt","\\\\$_\\c\$\\DIRECTORY");
}
###################################################
ALL_Workstations.log
workstation1
workstation2
workstation3
workstation4
workstation5
workstation6
workstation7
workstation8
.....
HTH - Stiddy
use File::Copy;
use Net:ing;
my $host = Net:ing->new("icmp");
##### Open logfiles for input and Read in machines to be tested #####
open (COPIED_FILE, ">>Copied_FIle.log");
open (UNREACHABLE, ">>UnReachable.log");
open (WKS, "<d:All_Workstations.log") || die ("Cannot open All_Workstations.log: $!");
while(<WKS>) {
chomp $_;
$_ =~ tr/a-z/A-Z/;
if ($host->ping($_, 5)){©_DATA}
else {
print "$_ unreachable\n";
print UNREACHABLE ("$_\n")
}
}
close COPIED_FILE;
close UNREACHABLE;
close WKS;
$host->close();
sub COPY_DATA {
copy("blah.txt","\\\\$_\\c\$\\DIRECTORY");
}
###################################################
ALL_Workstations.log
workstation1
workstation2
workstation3
workstation4
workstation5
workstation6
workstation7
workstation8
.....
HTH - Stiddy