This commit is contained in:
Grzegorz Budny 2020-03-15 19:41:05 +01:00
parent ff04ad34f2
commit 2f897350bc
2 changed files with 54 additions and 10 deletions

View file

@ -9,6 +9,13 @@
## Change log
- 15/4/2020
- RouterOS_Cloud_Backup.rsc
- RouterOS_FTP_Backup.rsc
- RouterOS_Function_Template.rsc
- RouterOS_PPP_Disconnect_Active_Sessions.rsc
- RouterOS_Recreate_Bridge.rsc
- 12/4/2019
- RouterOS_RadiusMonitor.rsc
- RouterOS_User_Alerts.rsc
@ -137,7 +144,7 @@ recipient=recipient@example.com;
**Example**
```
$CloudBackup smtpServer=smtpServer smtpPort=smtpPort domain=@example.com recipient=recipient@example.com;
$CloudBackup password=password;
```
### RouterOS_Create_Directory.rsc
@ -320,6 +327,29 @@ $UserAlert message="message" treshhold=3 fileName="fileName" smtpServer=smtpServ
recipient="recipient@example.com";
```
### RouterOS_FTP_Backup.rsc
> Creates backup files and sends them via FTP to FTP server
**Example**
```
$FTPBackup configName=configName backupName=backupName smtpServer=smtpServer smtpPort=smtpPort domain=@example.com \
recipient=recipient@example.com destPath=destPath ftpUser=user ftpPassword=password ftpServer=ftpserver;
```
### RouterOS_Function_Template.rsc
> Function template that I use
### RouterOS_PPP_Disconnect_Active_Sessions.rsc
> Disconnects all PPP active sessions at once
**Example**
```
$DisconnectPPPActveSessions;
```
### RouterOS_Recreate_Bridge.rsc
> Recreates bridge if broken or misconfigured
### More scripts comming soon :)
## Authors

View file

@ -1,26 +1,40 @@
# RouterOS Function
# Copyright (c) Grzegorz Budny
# Version 1.1
# Last update: 2/14/2020
# Version 1.2
# Last update: 3/15/2020
# Creates new backup file and uploads it to MikroTik Cloud
:global CloudBackup do={
:local systemLicense [/system license get value-name=level];
:local systemName [/system identity get value-name=name];
:local backupNumber [/system backup cloud print count-only];
:if ($currentLicenseLevel != "free") do={
:if ($backupNumber = 0) do={
:log info "...:::License allows cloud backup, process started:::..."
:log info "...:::No Cloud Backup Present!:::...";
:log info "...:::Cloud backup process started:::...";
/system backup cloud upload-file action=create-and-upload file=cloudBackup.backup password=password
/system backup cloud upload-file action=create-and-upload name=$systemName password=$password;
/tool e-mail send server=$smtpServer port=$smtpPort from=($systemName.$domain) \
to=$recipient subject=($systemName." cloud backup created.") body=($systemName." created MikroTik cloud backup.");
:log info "...:::Cloud Backup Created:::...";
}
:if ($backupNumber > 0) do={
:log warning "...:::Cloud Backup Present!:::...";
:log info "...:::Cloud backup process started:::...";
:log warning "...:::Removing current slot!:::...";
/system backup cloud remove-file 0;
:log warning "...:::Slot removed:::...";
:log info "...:::Cloud backup process started:::...";
/system backup cloud upload-file action=create-and-upload name=$systemName password=$password;
:log info "...:::Cloud Backup Created:::...";
}
}
$CloudBackup smtpServer=smtpServer smtpPort=smtpPort domain=@example.com recipient=recipient@example.com;
$CloudBackup password=password