mirror of
https://github.com/pothi/mikrotik-scripts.git
synced 2025-06-21 13:49:01 +02:00
New script to automate cloud backups
This commit is contained in:
parent
98f36b7472
commit
af15de2fe8
1 changed files with 30 additions and 0 deletions
30
scripts/cloud-backup.rsc
Normal file
30
scripts/cloud-backup.rsc
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
# Cloud Backup
|
||||||
|
|
||||||
|
# requirement/s:
|
||||||
|
:global cloudBackupPass
|
||||||
|
|
||||||
|
# permissions required: ftp, read, write, policy, test
|
||||||
|
|
||||||
|
:local backupName "Cloud Backup"
|
||||||
|
|
||||||
|
:log info "\nRunning the script \"cloud-backup\"..."
|
||||||
|
|
||||||
|
/system backup cloud
|
||||||
|
|
||||||
|
# Remove the backup if exists.
|
||||||
|
:if ( ([:pick [print as-value] 0]->"status") = "ok" ) do={
|
||||||
|
|
||||||
|
remove-file number=0
|
||||||
|
:delay 3s
|
||||||
|
:log info "Existing $backupName is removed to create-and-upload a new backup."
|
||||||
|
|
||||||
|
} else={ :log info "No existing $backupName found."; }
|
||||||
|
|
||||||
|
:log info "Creating a new $backupName..."
|
||||||
|
|
||||||
|
upload-file action=create-and-upload password=$cloudBackupPass
|
||||||
|
:delay 10s
|
||||||
|
|
||||||
|
:if ( ([:pick [print as-value] 0]->"status") = "ok" ) do={
|
||||||
|
:log info "$backupName is successful."
|
||||||
|
} else={ :log error "$backupName failed!" }
|
Loading…
Add table
Add a link
Reference in a new issue