Created
February 27, 2025 10:23
pfmloop: turn Netdisco 2 into Netdisco 1.x
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# instead of using netdisco-backend, this just runs N netdisco-do at a time, cranking through the whole | |
# list withouth defering, adding dynamic discovery etc | |
netdisco@disco050p:~/perl5/bin> cat pfmloop | |
#!/usr/bin/perl | |
use warnings; | |
use strict; | |
use Parallel::ForkManager; | |
use File::Slurp; | |
# txt: one ip/hostname per line | |
my @devices = read_file("/appl/netdisco/environments/host.txt", chomp => 1); | |
my $pm = Parallel::ForkManager->new(30); | |
DEVICES: | |
foreach my $d (@devices) { | |
$pm->start and next DEVICES; | |
print("============== $$ doing $d\n"); | |
`netdisco-do macsuck -d $d`; | |
$pm->finish; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment