aboutsummaryrefslogtreecommitdiffstats
path: root/cloud-backup
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2022-01-06 10:23:03 +0100
committerGravatar Christian Hesse <mail@eworm.de>2022-01-06 10:23:03 +0100
commit97f35dcf0e99738e9170a413f6be52c989708b9c (patch)
tree1b9dee4af1a834b4cc2fa83d713743708498f1f4 /cloud-backup
parent57c80dc2a42280c1a8d1f2c7de8d73a3e03190bc (diff)
parented0135c613b92ce59bda832f0e4a789a8268223f (diff)
Merge branch 'backup' into next
Diffstat (limited to 'cloud-backup')
-rw-r--r--cloud-backup58
1 files changed, 1 insertions, 57 deletions
diff --git a/cloud-backup b/cloud-backup
index ab2cf7c..2c48f07 100644
--- a/cloud-backup
+++ b/cloud-backup
@@ -1,58 +1,2 @@
#!rsc by RouterOS
-# RouterOS script: cloud-backup
-# Copyright (c) 2013-2022 Christian Hesse <mail@eworm.de>
-# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
-#
-# provides: backup-script
-#
-# upload backup to MikroTik cloud
-# https://git.eworm.de/cgit/routeros-scripts/about/doc/cloud-backup.md
-
-:local 0 "cloud-backup";
-:global GlobalFunctionsReady;
-:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
-
-:global BackupPassword;
-:global BackupRandomDelay;
-:global Identity;
-
-:global DeviceInfo;
-:global LogPrintExit2;
-:global RandomDelay;
-:global ScriptFromTerminal;
-:global SendNotification2;
-: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
- / system backup cloud print as-value;
- :if ([ :len [ / system backup cloud find ] ] > 0) do={
- / system backup cloud upload-file action=create-and-upload \
- password=$BackupPassword replace=[ get ([ find ]->0) name ];
- } else={
- / system backup cloud upload-file action=create-and-upload \
- password=$BackupPassword;
- }
- :local Cloud [ / system backup cloud get ([ find ]->0) ];
-
- $SendNotification2 ({ origin=$0; \
- subject=([ $SymbolForNotification "floppy-disk,cloud" ] . "Cloud backup"); \
- message=("Uploaded backup for " . $Identity . " to cloud.\n\n" . \
- [ $DeviceInfo ] . "\n\n" . \
- "Name: " . $Cloud->"name" . "\n" . \
- "Size: " . $Cloud->"size" . " B (" . ($Cloud->"size" / 1024) . " KiB)\n" . \
- "Download key: " . $Cloud->"secret-download-key"); silent=true });
-} on-error={
- $SendNotification2 ({ origin=$0; \
- subject=([ $SymbolForNotification "warning-sign" ] . "Cloud backup failed"); \
- message=("Failed uploading backup for " . $Identity . " to cloud!\n\n" . [ $DeviceInfo ]) });
- $LogPrintExit2 error $0 ("Failed uploading backup for " . $Identity . " to cloud!") true;
-}
+# dummy for migration