Skip to content
Snippets Groups Projects

#2838 added filtering of cronjobs by host

Merged Eric Zillmann requested to merge 2838-cronjobs-per-host into master
1 file
+ 19
0
Compare changes
  • Side-by-side
  • Inline
@@ -38,6 +38,25 @@ foreach ($input_files as $input_file) {
continue;
}
// Make sure to only use cronjobs for this host.
$host = gethostname();
foreach ($input_file_decoded as $key => $cronjob) {
// Make sure we have a valid entry.
if (!is_array($cronjob) || !isset($cronjob['host'])) {
continue;
}
// Remove non matching entries.
if ($host && $cronjob['host'] !== $host) {
unset($input_file_decoded[$key]);
continue;
}
// Remove the "host" key as this is not a valid cron key.
unset($input_file_decoded[$key]['host']);
}
// Merge the decoded file contents to the result.
$crontab_definitions = array_merge($crontab_definitions, $input_file_decoded);
}
Loading