Skip to content

Commit 90866ad

Browse files
authored
Merge pull request #2516 from MPOS/cron-maintenance
[ADDED] Temporarily disable all crons on pool maintenance
2 parents 62e01bd + c35b232 commit 90866ad

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

cronjobs/shared.inc.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ function cfip() { return (@defined('SECURITY')) ? 1 : 0; }
6969
// Load the start time for later runtime calculations for monitoring
7070
$cron_start[$cron_name] = microtime(true);
7171

72+
// Skip all crons if admin enabled pool maintenance
73+
if ($setting->getValue('maintenance')) {
74+
$log->logInfo('Cronjobs disabled due to pool maintenance');
75+
$monitoring->endCronjob($cron_name, 'E0083', 2, true, false);
76+
}
77+
7278
// Check if our cron is activated
7379
if ($monitoring->isDisabled($cron_name)) {
7480
$log->logFatal('Cronjob is currently disabled due to errors, use -f option to force running cron.');

include/classes/monitoring.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function endCronjob($cron_name, $msgCode, $exitCode=0, $fatal=false, $mai
131131
$this->setErrorMessage('Failed to send mail notification');
132132
}
133133
if ($fatal) {
134-
if ($exitCode != 0) $this->setStatus($cron_name . "_disabled", "yesno", 1);
134+
if ($exitCode == 1) $this->setStatus($cron_name . "_disabled", "yesno", 1);
135135
exit($exitCode);
136136
}
137137
}

include/config/error_codes.inc.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,4 @@
7878
$aErrorCodes['E0080'] = 'No new unaccounted shares since last run';
7979
$aErrorCodes['E0081'] = 'Failed to insert new block into database';
8080
$aErrorCodes['E0082'] = 'Block does not supply any usable confirmation information';
81+
$aErrorCodes['E0083'] = 'Maintenance mode enabled, skipped';

templates/bootstrap/admin/monitoring/default.tpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
{if $event.type == 'okerror'}
2626
{if $event.value == 0}
2727
<font color="green">OK</font>
28+
{else if $event.value == 2}
29+
<font color="orange">WARN</font>
2830
{else}
2931
<font color="red">ERROR</font>
3032
{/if}

0 commit comments

Comments
 (0)