Subversion Repositories sysadmin_scripts

Rev

Rev 142 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#! /usr/bin/env perl

use strict;
use warnings;

my @servers = ( 
   'enfocus.primarycolors.local',
   'remote0',
   'remote1',
   'remote2',
   'remote3',
   'zabbix.primarycolors.local',
   'netserver.primarycolorinc.com'   
   );
   
my $virsh = '/usr/bin/virsh start ';

my $output = `virsh list`;

foreach my $server ( @servers ) {
   if ( $output =~ m/$server/ ) {
      unlink "/tmp/$server.down" if  -e "/tmp/$server.down";
   } else {
      if ( -e "/tmp/$server.down" ) {
         print "$server has been down for a while, starting back up\n";
         `$virsh $server`; 
         unlink "/tmp/$server.down";
      } else {
         `touch /tmp/$server.down`;
      }
   }
}

1;