Since the machines are dual-boot Windows/Linux we want to be able to ensure they are in Linux remotely: set default boot to Linux (in /etc/grub.conf) and use Windows Resource Kit utility shutdown).
#!/usr/bin/perl use strict; my @machines = ("130.88.149.97", ..., "130.88.149.121"); my @machines = ("130.88.", ..., "130.88."); my @windows = (); my @linux = (); my @down = (); foreach my $m (@machines) { if (&machine_windows($m)) { push(@windows, $m); } if (&machine_linux($m)) { push(@linux, $m); } if (&machine_down($m)) { push(@down, $m); } } foreach (@windows) { print "\n Wins: $_"; } foreach (@linux) { print "\n LInux: $_"; } foreach (@down) { print "\n Down: $_"; } print "\n\n"; # --------------------------------------------------------------------------- # --------------------------------------------------------------------------- sub machine_windows() { my $machine = shift; my $string = ""; my @results = `nmap -sT $machine`; foreach my $r (@results) { if ($r =~ m/(netbios)|(microsoft)|(loc\-srv)|(svrloc)/) { chomp($r); $string .= $r; } } if ($string =~ m/\S/) {return 1} else {return 0} } # --------------------------------------------------------------------------- sub machine_linux() { } # --------------------------------------------------------------------------- sub machine_down() { } # --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
...previous | cont's... |