|
|
@ -553,7 +553,11 @@ sub handle_periodic_tasks |
|
|
|
|
|
|
|
|
|
|
|
# Check if anything is needed to be done in /mnt/shared. |
|
|
|
# Check if anything is needed to be done in /mnt/shared. |
|
|
|
check_incoming($anvil); |
|
|
|
check_incoming($anvil); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Get a screenshot from every server (cluster resource) |
|
|
|
|
|
|
|
# running on localhost and punt them to all strikers. |
|
|
|
|
|
|
|
get_server_screenshot($anvil); |
|
|
|
|
|
|
|
|
|
|
|
# Check for stale db_in_use states. |
|
|
|
# Check for stale db_in_use states. |
|
|
|
check_db_in_use_states($anvil); |
|
|
|
check_db_in_use_states($anvil); |
|
|
|
} |
|
|
|
} |
|
|
@ -1815,3 +1819,59 @@ sub update_state_file |
|
|
|
|
|
|
|
|
|
|
|
return(0); |
|
|
|
return(0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub get_server_screenshot |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
my $anvil = shift; |
|
|
|
|
|
|
|
my $parameters = shift; |
|
|
|
|
|
|
|
my $debug = $parameters->{debug} // 3; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $query = "SELECT host_uuid FROM hosts WHERE host_type = 'striker';"; |
|
|
|
|
|
|
|
my $results = $anvil->Database->query({ query => $query, source => $THIS_FILE, line => __LINE__ }); |
|
|
|
|
|
|
|
my $count = @{$results}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $striker_uuid_csv; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (1) if ($count == 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$striker_uuid_csv = $results->[0]->[0]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach my $row ( @{$results}[1 .. $#{$results}] ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
my $host_uuid = $row->[0]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$striker_uuid_csv = "$striker_uuid_csv,$host_uuid"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my ($rcode) = $anvil->Server->find(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (1) if ($rcode != 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $server_list_on_local = $anvil->data->{server}{location}; |
|
|
|
|
|
|
|
my $server_name_csv = join(", ", map { $anvil->Database->quote($_) } keys %{$server_list_on_local}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$query = "SELECT server_uuid FROM servers WHERE server_name IN (".$server_name_csv.") ORDER BY server_name;"; |
|
|
|
|
|
|
|
$results = $anvil->Database->query({ query => $query, source => $THIS_FILE, line => __LINE__ }); |
|
|
|
|
|
|
|
$count = @{$results}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (1) if ($count == 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach my $row ( @{$results} ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
my $server_uuid = $row->[0]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my ($syscall_output, $syscall_rcode) = $anvil->System->call({ |
|
|
|
|
|
|
|
debug => $debug, |
|
|
|
|
|
|
|
line => __LINE__, |
|
|
|
|
|
|
|
shell_call => $anvil->data->{path}{exe}{'anvil-get-server-screenshot'}." --server-uuid '$server_uuid' --request-host-uuid '$striker_uuid_csv'", |
|
|
|
|
|
|
|
source => $THIS_FILE, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$anvil->Log->variables({ source => $THIS_FILE, line => __LINE__, level => $debug, list => { |
|
|
|
|
|
|
|
syscall_output => $syscall_output, |
|
|
|
|
|
|
|
syscall_rcode => $syscall_rcode, |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (0); |
|
|
|
|
|
|
|
} |