mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-18 10:35:27 +00:00
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:
parent
bcc067cb7c
commit
041cf134f6
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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()) {
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user