Skip to content

Instantly share code, notes, and snippets.

@rc9000
Created February 27, 2025 10:23
pfmloop: turn Netdisco 2 into Netdisco 1.x
# 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