aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2021-02-23 09:55:14 +0100
committerGravatar Christian Hesse <mail@eworm.de>2021-02-24 21:51:56 +0100
commit6770a15a7d1df1ef5f2cc0a6f82e0d4f82b214d6 (patch)
treea4a6932921381bce8ae605aebd2cd1b85b30a4c2
parent766a92a74b728653ae73df7566f1ed34981c1063 (diff)
cloud-backup: add configurable random delay
-rw-r--r--cloud-backup7
-rw-r--r--doc/cloud-backup.md3
-rw-r--r--global-config1
3 files changed, 10 insertions, 1 deletions
diff --git a/cloud-backup b/cloud-backup
index 598a500..aa29faa 100644
--- a/cloud-backup
+++ b/cloud-backup
@@ -11,16 +11,23 @@
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:global BackupPassword;
+:global BackupRandomDelay;
:global Identity;
:global DeviceInfo;
:global LogPrintExit2;
+:global RandomDelay;
+:global ScriptFromTerminal;
:global SendNotification;
:global SymbolForNotification;
:global WaitFullyConnected;
$WaitFullyConnected;
+:if ([ $ScriptFromTerminal $0 ] = false && $BackupRandomDelay > 0) do={
+ $RandomDelay $BackupRandomDelay;
+}
+
:do {
# we are not interested in output, but print is
# required to fetch information from cloud
diff --git a/doc/cloud-backup.md b/doc/cloud-backup.md
index bda1267..1417242 100644
--- a/doc/cloud-backup.md
+++ b/doc/cloud-backup.md
@@ -18,9 +18,10 @@ Just install the script:
Configuration
-------------
-The configuration goes to `global-config-overlay`, this is the only parameter:
+The configuration goes to `global-config-overlay`, these are the parameters:
* `BackupPassword`: password to encrypt the backup with
+* `BackupRandomDelay`: delay up to amount of seconds when run from scheduler
Also notification settings are required for e-mail and telegram.
diff --git a/global-config b/global-config
index d9c8061..d25c456 100644
--- a/global-config
+++ b/global-config
@@ -42,6 +42,7 @@
:global BackupSendBinary false;
:global BackupSendExport true;
:global BackupPassword "v3ry-s3cr3t";
+:global BackupRandomDelay 0;
# These addresses are used to send backup and config export files to.
:global EmailBackupTo "";
:global EmailBackupCc "";