refactor: replace_key_job cron to run on a randomized minute value

This commit is contained in:
Zack Spear
2024-02-05 11:34:24 -08:00
committed by Zack Spear
parent 0f31f97d88
commit d81e24e827
@@ -4,11 +4,13 @@ $docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/plugins/dynamix/include/Wrappers.php";
require_once "$docroot/plugins/dynamix/include/ReplaceKey.php";
$randomMinute = rand(0, 59);
switch (@$argv[1] ?? '') {
case 'cron-init':
$text = <<<EOT
# Create replace key job:
15 * * * * /usr/local/emhttp/plugins/dynamix/scripts/replace_key_job &> /dev/null
$randomMinute * * * * /usr/local/emhttp/plugins/dynamix/scripts/replace_key_job &> /dev/null
EOT;
parse_cron_cfg("dynamix", "replace-key-job", $text);