@ -67,7 +67,19 @@ if (not $anvil->data->{sys}{database}{connections})
}
# Clear the job in case a previous call failed.
$anvil->Job->clear({debug => 2, job_uuid => $anvil->data->{switches}{'job-uuid'}}) if $anvil->data->{switches}{'job-uuid'};
if ($anvil->data->{switches}{'job-uuid'})
{
$anvil->Job->clear({debug => 2, job_uuid => $anvil->data->{switches}{'job-uuid'}});
my $task = $anvil->data->{switches}{'reboot'} ? "log_0226" : "log_0225";
$anvil->Job->update_progress({
debug => 2,
progress => 1,
message => "message_0352",
job_uuid => $anvil->data->{switches}{'job-uuid'},
log_level => 1,
variables => { task => $task },
});
}
# Are we being asked to reboot or power off?
if ($anvil->data->{switches}{'reboot'})
@ -188,6 +200,17 @@ sub do_poweroff
my ($anvil, $task) = @_;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { task => $task }});
if ($anvil->data->{switches}{'job-uuid'})
{
$anvil->Job->update_progress({
debug => 2,
progress => 10,
message => "message_0351",
log_level => 1,
job_uuid => $anvil->data->{switches}{'job-uuid'},
});
}
# In case we're being called by another job, we'll sleep for a few second to let those close out.
sleep 3;
@ -208,6 +231,7 @@ sub do_poweroff
if (($uptime) && ($uptime < 300))
{
# We'll wait until the system has been running for five minutes.
my $difference = 300 - $uptime;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, secure => 0, key => "log_0224", variables => {
task => $task eq "poweroff" ? "#!string!log_0225!#" : "#!string!log_0226!#",
@ -287,10 +311,11 @@ sub do_poweroff
if ($job_uuid)
{
$anvil->Job->update_progress({
debug => 2,
progress => 100,
message => $say_task,
job_uuid => $job_uuid,
debug => 2,
progress => 100,
message => $say_task,
log_level => 1,
job_uuid => $job_uuid,
});
}