From bc8b19fc31a2c2c437c6fea703b601b802470e02 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 23 Feb 2021 09:56:28 +0100 Subject: upload-backup: add configurable random delay --- upload-backup | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'upload-backup') diff --git a/upload-backup b/upload-backup index 1e3e8e8..15adc1f 100644 --- a/upload-backup +++ b/upload-backup @@ -11,6 +11,7 @@ :while ($GlobalFunctionsReady != true) do={ :delay 500ms; } :global BackupPassword; +:global BackupRandomDelay; :global BackupSendBinary; :global BackupSendExport; :global BackupUploadPass; @@ -23,18 +24,24 @@ :global DeviceInfo; :global IfThenElse; :global LogPrintExit2; +:global RandomDelay; +:global ScriptFromTerminal; :global SendNotification; :global SymbolForNotification; :global WaitForFile; :global WaitFullyConnected; -$WaitFullyConnected; - :if ($BackupSendBinary != true && \ $BackupSendExport != true) do={ $LogPrintExit2 error $0 ("Configured to send neither backup nor config export.") true; } +$WaitFullyConnected; + +:if ([ $ScriptFromTerminal $0 ] = false && $BackupRandomDelay > 0) do={ + $RandomDelay $BackupRandomDelay; +} + # filename based on identity :local FileName [ $CharacterReplace ($Identity . "." . $Domain) "." "_" ]; :local BackupFile "none"; -- cgit v1.2.3-70-g09d2