Merge pull request #95 from ClusterLabs/anvil-tools-dev

* Created the function check_daemons() in anvil-daemon to check that …
main
digimer-bot 4 years ago committed by GitHub
commit 992143ef1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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