This moves the call of anvil-safe-start out of scancore and into a new, dedicated systemd unit that runs on boot only.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 2 years ago
parent 6bce292969
commit fb70836126
  1. 2
      anvil.spec.in
  2. 20
      tools/scancore
  3. 1
      units/Makefile.am
  4. 11
      units/anvil-safe-start.service

@ -388,7 +388,7 @@ fi
%{_usr}/lib/ocf/resource.d/alteeve/server %{_usr}/lib/ocf/resource.d/alteeve/server
%files dr %files dr
#<placeholder for node specific files> #<placeholder for dr specific files>
%changelog %changelog

@ -429,33 +429,17 @@ sub startup_tasks
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { variable_uuid => $variable_uuid }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { variable_uuid => $variable_uuid }});
# If this is a node and we've been up for less than ten minutes, call anvil-safe-start as a # This used to call anvil-safe-start, which isn't done here anymore.
# background process. It will exit if it is disabled.
my $host_type = $anvil->Get->host_type(); my $host_type = $anvil->Get->host_type();
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { host_type => $host_type }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { host_type => $host_type }});
if ($host_type eq "node") if ($host_type eq "node")
{ {
my $uptime = $anvil->Get->uptime; # For future use.
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { uptime => $uptime }});
if ($uptime < 600)
{
# Run it as a background task
my $shell_call = $anvil->data->{path}{exe}{'anvil-safe-start'}.$anvil->Log->switches;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "log_0210", variables => { command => $shell_call }});
$anvil->System->call({shell_call => $shell_call, background => 1});
}
else
{
# Log that we've been up too long to auto-start the cluster.
my $say_uptime = $anvil->Convert->time({'time' => $uptime});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "log_0620", variables => { uptime => $say_uptime }});
}
} }
elsif ($host_type eq "striker") elsif ($host_type eq "striker")
{ {
# We're a striker, so we're going to check for / remove transient database records on tables # We're a striker, so we're going to check for / remove transient database records on tables
# that always grow (temperature, power, etc) and whose data loses value as it ages. # that always grow (temperature, power, etc) and whose data loses value as it ages.
} }
return(0); return(0);

@ -3,5 +3,6 @@ MAINTAINERCLEANFILES = Makefile.in
servicedir = $(SYSTEMD_UNIT_DIR) servicedir = $(SYSTEMD_UNIT_DIR)
dist_service_DATA = \ dist_service_DATA = \
anvil-daemon.service \ anvil-daemon.service \
anvil-safe-start.service \
scancore.service \ scancore.service \
striker-ui-api.service striker-ui-api.service

@ -0,0 +1,11 @@
[Unit]
Description=Anvil! IA Platform - This service sanity checks and, if all is well, auto-starts the cluster and servers
Wants=network.target
[Service]
ExecStart=/usr/sbin/anvil-safe-start
RemainAfterExit=true
Type=oneshot
[Install]
WantedBy=multi-user.target
Loading…
Cancel
Save