Subversion Repositories sysadmin_scripts

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
141 rodolico 1
#! /usr/bin/env perl
2
 
3
use strict;
4
use warnings;
5
 
6
my @servers = ( 
7
   'enfocus.primarycolors.local',
8
   'remote0',
9
   'remote1',
10
   'remote2',
11
   'remote3',
12
   'zabbix.primarycolors.local',
13
   'netserver.primarycolorinc.com'   
14
   );
15
 
16
my $virsh = '/usr/bin/virsh start ';
17
 
18
my $output = `virsh list`;
19
 
20
foreach my $server ( @servers ) {
21
   if ( $output =~ m/$server/ ) {
22
      unlink "/tmp/$server.down" if  -e "/tmp/$server.down";
23
   } else {
24
      if ( -e "/tmp/$server.down" ) {
25
         print "$server has been down for a while, starting back up\n";
26
         `$virsh $server`; 
27
         unlink "/tmp/$server.down";
28
      } else {
29
         `touch /tmp/$server.down`;
30
      }
31
   }
32
}
33
 
34
1;