Merge pull request #617 from ClusterLabs/daemon-management

Added '--all' to anvil-manage-daemons to enable optional daemons.
main
Fabio M. Di Nitto 9 months ago committed by GitHub
commit 4ab21013c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      man/anvil-manage-daemons.8
  2. 28
      tools/anvil-manage-daemons

@ -21,12 +21,15 @@ When logging, record sensitive data, like passwords.
Set the log level to 1, 2 or 3 respectively. Be aware that level 3 generates a significant amount of log data. Set the log level to 1, 2 or 3 respectively. Be aware that level 3 generates a significant amount of log data.
.SS "Commands:" .SS "Commands:"
.TP .TP
\fB\-\-enable\fR \fB\-\-all\fR
All Anvil! daemons that are not enabled will be enabled. There are performance monitoring daemons, like 'anvil-monitor-daemons' and 'anvil-monitor-performance' which log daemon states and performance data. When disabling, these are disabled. When enabling, these are NOT enabled. Using \fB\-\-all\fR will enable these daemons.
.TP .TP
\fB\-\-disable\fR \fB\-\-disable\fR
All Anvil! daemons that are not disabled will be disabled. All Anvil! daemons that are not disabled will be disabled.
.TP .TP
\fB\-\-enable\fR
All Anvil! daemons that are not enabled will be enabled.
.TP
\fB\-\-log\-only\fR \fB\-\-log\-only\fR
if this is passed, it monitors the status of the daemons, but does not try to recover failed ones. if this is passed, it monitors the status of the daemons, but does not try to recover failed ones.
.TP .TP

@ -26,8 +26,9 @@ my $anvil = Anvil::Tools->new();
# Read switches # Read switches
$anvil->Get->switches({list => [ $anvil->Get->switches({list => [
"enable", "all",
"disable", "disable",
"enable",
"log-only", "log-only",
"monitor", "monitor",
"now", "now",
@ -40,10 +41,10 @@ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, secure =
# Common daemons # Common daemons
$anvil->data->{daemons}{core}{'anvil-daemon'} = "anvil-daemon.service"; $anvil->data->{daemons}{core}{'anvil-daemon'} = "anvil-daemon.service";
$anvil->data->{daemons}{core}{'anvil-monitor-daemons'} = "anvil-monitor-daemons.service"; $anvil->data->{daemons}{core}{'scancore'} = "scancore.service";
$anvil->data->{daemons}{core}{'anvil-monitor-network'} = "anvil-monitor-network.service"; $anvil->data->{daemons}{core}{'anvil-monitor-network'} = "anvil-monitor-network.service";
$anvil->data->{daemons}{core}{'anvil-monitor-daemons'} = "anvil-monitor-daemons.service";
$anvil->data->{daemons}{core}{'anvil-monitor-performance'} = "anvil-monitor-performance.service"; $anvil->data->{daemons}{core}{'anvil-monitor-performance'} = "anvil-monitor-performance.service";
$anvil->data->{daemons}{core}{'scancore'} = "scancore.service";
# Striker dashboards. # Striker dashboards.
$anvil->data->{daemons}{striker}{'striker-ui-api'} = "striker-ui-api.service"; $anvil->data->{daemons}{striker}{'striker-ui-api'} = "striker-ui-api.service";
@ -266,6 +267,17 @@ sub process_daemons
# Enable or disable? # Enable or disable?
if (($anvil->data->{switches}{enable}) && ($anvil->data->{daemon}{$daemon}{enabled}{return_code} == 1)) if (($anvil->data->{switches}{enable}) && ($anvil->data->{daemon}{$daemon}{enabled}{return_code} == 1))
{ {
# Is this optional, and if so, did they use '--all'?
if (($daemon eq 'anvil-monitor-daemons') or ($daemon eq 'anvil-monitor-performance'))
{
if (not $anvil->data->{switches}{all})
{
# Skip this
print "The daemon: [".$daemon."] is not critical, and '--all' not used, not enabling it.\n";
next;
}
}
my $shell_call = $anvil->data->{path}{exe}{systemctl}." enable ".$daemon; my $shell_call = $anvil->data->{path}{exe}{systemctl}." enable ".$daemon;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => { shell_call => $shell_call }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => { shell_call => $shell_call }});
@ -292,6 +304,16 @@ sub process_daemons
# Start or stop? # Start or stop?
if (($anvil->data->{switches}{start}) && ($anvil->data->{daemon}{$daemon}{active}{return_code} == 3)) if (($anvil->data->{switches}{start}) && ($anvil->data->{daemon}{$daemon}{active}{return_code} == 3))
{ {
if (($daemon eq 'anvil-monitor-daemons') or ($daemon eq 'anvil-monitor-performance'))
{
if (not $anvil->data->{switches}{all})
{
# Skip this
print "The daemon: [".$daemon."] is not critical, and '--all' not used, not starting it.\n";
next;
}
}
my $shell_call = $anvil->data->{path}{exe}{systemctl}." start ".$daemon; my $shell_call = $anvil->data->{path}{exe}{systemctl}." start ".$daemon;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => { shell_call => $shell_call }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => { shell_call => $shell_call }});

Loading…
Cancel
Save