system - remote backup / add an optional random delay before executing remote backups, 3600 seconds max when executed automatically in the nighly run. ref https://github.com/opnsense/plugins/pull/3689

This commit is contained in:
Ad Schellevis 2023-11-29 18:05:58 +01:00
parent bcc067cb7c
commit 041cf134f6
3 changed files with 8 additions and 2 deletions

View File

@ -329,7 +329,7 @@ function core_cron()
foreach ((new OPNsense\Backup\BackupFactory())->listProviders() as $classname => $provider) {
if ($provider['handle']->isEnabled()) {
$jobs[]['autocron'] = array('/usr/local/sbin/configctl -d system remote backup', 0, 1);
$jobs[]['autocron'] = array('/usr/local/sbin/configctl -d system remote backup 3600', 0, 1);
break;
}
}

View File

@ -5,6 +5,12 @@ require_once('script/load_phalcon.php');
use OPNsense\Backup\BackupFactory;
/* add random delay in seconds */
$random_delay = !empty($argv[1]) ? $argv[1] : null;
if (!empty($random_delay)) {
sleep(rand(0, $random_delay));
}
$backupFact = new BackupFactory();
foreach ($backupFact->listProviders() as $classname => $provider) {
if ($provider['handle']->isEnabled()) {

View File

@ -42,7 +42,7 @@ message:List SSL ciphers
[remote.backup]
command:/usr/local/opnsense/scripts/system/remote_backup.php
parameters:
parameters: %s
type:script
message:Performing remote backup
description:Remote backup