Skip to content

Commit

Permalink
Adjustments to cron echo for docker logs to keep better track of whic…
Browse files Browse the repository at this point in the history
…h one is cancelled
  • Loading branch information
austinwbest committed Jul 14, 2024
1 parent 84a0053 commit a768f61
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 27 deletions.
17 changes: 11 additions & 6 deletions root/app/www/public/crons/health.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@

logger(SYSTEM_LOG, 'Cron: running health');
logger(CRON_HEALTH_LOG, 'run ->');
echo 'Cron run started: health' . "\n";
echo date('c') . ' Cron: health ->' . "\n";

if ($settingsFile['tasks']['health']['disabled']) {
logger(CRON_HEALTH_LOG, 'Cron run stopped: disabled in tasks menu');
echo date('c') . ' Cron run cancelled: disabled in tasks menu' . "\n";
logger(CRON_HEALTH_LOG, 'Cron cancelled: disabled in tasks menu');
logger(CRON_HEALTH_LOG, 'run <-');
echo date('c') . ' Cron: health cancelled, disabled in tasks menu' . "\n";
echo date('c') . ' Cron: health <-' . "\n";
exit();
}

if (!$settingsFile['global']['restartUnhealthy'] && !$settingsFile['notifications']['triggers']['health']['active']) {
logger(CRON_HEALTH_LOG, 'Cron run stopped: restart and notify disabled');
echo date('c') . ' Cron run stopped: restart and notify disabled' . "\n";
logger(CRON_HEALTH_LOG, 'Cron cancelled: restart and notify disabled');
logger(CRON_HEALTH_LOG, 'run <-');
echo date('c') . ' Cron health cancelled: restart unhealthy and notify disabled' . "\n";
echo date('c') . ' Cron: health <-' . "\n";
exit();
}

Expand Down Expand Up @@ -135,4 +139,5 @@
setFile(APP_DATA_PATH . 'health.json', []);
}

logger(CRON_HEALTH_LOG, 'run <-');
echo date('c') . ' Cron: health <-' . "\n";
logger(CRON_HEALTH_LOG, 'run <-');
11 changes: 7 additions & 4 deletions root/app/www/public/crons/housekeeper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@

logger(SYSTEM_LOG, 'Cron: running housekeeper');
logger(CRON_HOUSEKEEPER_LOG, 'run ->');
echo date('c') . ' Cron run started: housekeeper' . "\n";
echo date('c') . ' Cron: housekeeper ->' . "\n";

if ($settingsFile['tasks']['housekeeping']['disabled']) {
logger(CRON_HOUSEKEEPER_LOG, 'Cron run stopped: disabled in tasks menu');
echo date('c') . ' Cron run cancelled: disabled in tasks menu' . "\n";
logger(CRON_HOUSEKEEPER_LOG, 'Cron cancelled: disabled in tasks menu');
logger(CRON_HOUSEKEEPER_LOG, 'run <-');
echo date('c') . ' Cron: housekeeper cancelled, disabled in tasks menu' . "\n";
echo date('c') . ' Cron: housekeeper <-' . "\n";
exit();
}

Expand Down Expand Up @@ -129,4 +131,5 @@
}
}

logger(CRON_HOUSEKEEPER_LOG, 'run <-');
echo date('c') . ' Cron: housekeeper <-' . "\n";
logger(CRON_HOUSEKEEPER_LOG, 'run <-');
11 changes: 7 additions & 4 deletions root/app/www/public/crons/prune.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@

logger(SYSTEM_LOG, 'Cron: running prune');
logger(CRON_PRUNE_LOG, 'run ->');
echo date('c') . ' Cron run started: prune' . "\n";
echo date('c') . ' Cron: prune ->' . "\n";

if ($settingsFile['tasks']['prune']['disabled']) {
logger(CRON_PRUNE_LOG, 'Cron run stopped: disabled in tasks menu');
echo date('c') . ' Cron run cancelled: disabled in tasks menu' . "\n";
logger(CRON_PRUNE_LOG, 'Cron cancelled: disabled in tasks menu');
logger(CRON_PRUNE_LOG, 'run <-');
echo date('c') . ' Cron: prune cancelled, disabled in tasks menu' . "\n";
echo date('c') . ' Cron: prune <-' . "\n";
exit();
}

Expand Down Expand Up @@ -93,4 +95,5 @@
$notifications->notify($settingsFile['notifications']['triggers']['prune']['platform'], $payload);
}

logger(CRON_PRUNE_LOG, 'run <-');
echo date('c') . ' Cron: prune <-' . "\n";
logger(CRON_PRUNE_LOG, 'run <-');
10 changes: 7 additions & 3 deletions root/app/www/public/crons/pulls.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@

logger(SYSTEM_LOG, 'Cron: running pulls');
logger(CRON_PULLS_LOG, 'run ->');
echo date('c') . ' Cron run started: pulls' . "\n";
echo date('c') . ' Cron: pulls' . "\n";

if ($settingsFile['tasks']['pulls']['disabled']) {
logger(CRON_PULLS_LOG, 'Cron run stopped: disabled in tasks menu');
echo date('c') . ' Cron run cancelled: disabled in tasks menu' . "\n";
logger(CRON_PULLS_LOG, 'Cron cancelled: disabled in tasks menu');
logger(CRON_PULLS_LOG, 'run <-');
echo date('c') . ' Cron: pulls cancelled, disabled in tasks menu' . "\n";
echo date('c') . ' Cron: pulls <-' . "\n";
exit();
}

Expand Down Expand Up @@ -352,4 +354,6 @@
}
}


echo date('c') . ' Cron: pulls <-' . "\n";
logger(CRON_PULLS_LOG, 'run <-');
8 changes: 5 additions & 3 deletions root/app/www/public/crons/sse.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@

logger(SYSTEM_LOG, 'Cron: running sse');
logger(CRON_SSE_LOG, 'run ->');
echo date('c') . ' Cron run started: sse' . "\n";
echo date('c') . ' Cron: sse' . "\n";

if (!$settingsFile['global']['sseEnabled']) {
logger(CRON_SSE_LOG, 'Cron run stopped: disabled in tasks menu');
logger(CRON_SSE_LOG, 'Cron cancelled: disabled in tasks menu');
logger(CRON_SSE_LOG, 'run <-');
echo date('c') . ' Cron run cancelled: disabled in tasks menu' . "\n";
echo date('c') . ' Cron: sse cancelled, disabled in tasks menu' . "\n";
echo date('c') . ' Cron: sse <-' . "\n";
exit();
}

Expand All @@ -34,4 +35,5 @@

setFile(SSE_FILE, $updatedProcessList);

echo date('c') . ' Cron: sse <-' . "\n";
logger(CRON_SSE_LOG, 'run <-');
9 changes: 6 additions & 3 deletions root/app/www/public/crons/state.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@

logger(SYSTEM_LOG, 'Cron: running state');
logger(CRON_STATE_LOG, 'run ->');
echo date('c') . ' Cron run started: state' . "\n";
echo date('c') . ' Cron: state' . "\n";

if ($settingsFile['tasks']['state']['disabled']) {
logger(CRON_STATE_LOG, 'Cron run stopped: disabled in tasks menu');
echo date('c') . ' Cron run cancelled: disabled in tasks menu' . "\n";
logger(CRON_STATE_LOG, 'Cron cancelled: disabled in tasks menu');
logger(CRON_STATE_LOG, 'run <-');
echo date('c') . ' Cron: state cancelled, disabled in tasks menu' . "\n";
echo date('c') . ' Cron: state <-' . "\n";
exit();
}

Expand Down Expand Up @@ -198,4 +200,5 @@
}
}

echo date('c') . ' Cron: state <-' . "\n";
logger(CRON_STATE_LOG, 'run <-');
11 changes: 7 additions & 4 deletions root/app/www/public/crons/stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@

logger(SYSTEM_LOG, 'Cron: running stats');
logger(CRON_STATS_LOG, 'run ->');
echo date('c') . ' Cron run started: stats' . "\n";
echo date('c') . ' Cron: stats' . "\n";

if ($settingsFile['tasks']['stats']['disabled']) {
logger(CRON_STATS_LOG, 'Cron run stopped: disabled in tasks menu');
echo date('c') . ' Cron run cancelled: disabled in tasks menu' . "\n";
logger(CRON_STATS_LOG, 'Cron cancelled: disabled in tasks menu');
logger(CRON_STATS_LOG, 'run <-');
echo date('c') . ' Cron: stats cancelled, disabled in tasks menu' . "\n";
echo date('c') . ' Cron: stats <-' . "\n";
exit();
}

$dockerStats = $docker->stats(false);
setServerFile('stats', $dockerStats);

logger(CRON_STATS_LOG, 'run <-');
echo date('c') . ' Cron: stats <-' . "\n";
logger(CRON_STATS_LOG, 'run <-');

0 comments on commit a768f61

Please sign in to comment.