* Created the function check_daemons() in anvil-daemon to check that needed daemons are running when it starts. This was specifically added to address a periodic issue with machines booting without NetworkManager running.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 4 years ago
parent 7495950b83
commit ff65712fd9
  1. 2
      share/words.xml
  2. 27
      tools/anvil-daemon

@ -2120,6 +2120,8 @@ Are you sure that you want to delete the server: [#!variable!server_name!#]? [Ty
<key name="message_0246">Purging the Anvil!: [#!variable!anvil_name!#] (UUID: [#!variable!anvil_uuid!#]:</key>
<key name="message_0247"><![CDATA[Please specify which server you want to manage with '--server <name_or_uuid>'. Available servers on this Anvil! system;]]></key>
<key name="message_0248">Created the journald directory: [#!variable!directory!#].</key>
<key name="message_0249">Checking that the daemon: [#!variable!daemon!#] is running.</key>
<key name="message_0250">The daemon: [#!variable!daemon!#] was not running, starting it now.</key>
<!-- Success messages shown to the user -->
<key name="ok_0001">Saved the mail server information successfully!</key>

@ -579,9 +579,12 @@ sub run_once
# Check to see if we need to do boot-time tasks. We only run these if we've just booted
boot_time_tasks($anvil);
# Check that the daemons we need are running.
check_daemons($anvil);
# Check the ssh stuff.
# NOTE: This actually runs again in the minutes tasks, but needs to run on boot as well.
$anvil->System->check_ssh_keys({debug => 3});
$anvil->System->check_ssh_keys();
# Check setuid wrappers
check_setuid_wrappers($anvil);
@ -597,6 +600,28 @@ sub run_once
return(0);
}
sub check_daemons
{
my ($anvil) = @_;
foreach my $daemon ("NetworkManager")
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "message_0249", variables => { daemon => $daemon }});
my $running = $anvil->System->check_daemon({daemon => $daemon});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { running => $running }});
if (not $running)
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "message_0250", variables => { daemon => $daemon }});
my $return_code = $anvil->System->start_daemon({daemon => $daemon});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { return_code => $return_code }});
}
}
return(0);
}
sub check_journald
{
my ($anvil) = @_;

Loading…
Cancel
Save