beeyev / Mikrotik-RouterOS-automatic-backup-and-update

Script sends backups to email and keep your mikrotik firmware up to date.
MIT License
433 stars 83 forks source link

Add upload backup via FTP/SFTP #11

Open rechandler12 opened 3 years ago

rechandler12 commented 3 years ago

Hi! Could you add uploading file backup via FTP/SFTP protocol? It would required the file name was unique so I suggest to add pattern to the file name like yyyy-MM-dd or yyyy-MM-dd-hh-mm.

beeyev commented 3 years ago

Okay, I will (i hope lol) implement this feature in the next release.

rechandler12 commented 3 years ago

wow, great! Thanks

BrandonSk commented 2 years ago

Hi, I added the FTP feature to the script. I do not want to create a separate fork for it and I'm happy to share the code here. What is the best way to do that? Cheers, B.

PS: Nevermind, I made a fork here https://github.com/BrandonSk/Mikrotik-RouterOS-automatic-backup-and-update-With-FTP. If you like the code, just merge it with the original. Cheers.

PS: As I tried to keep the original functionality intact, but add additional logic, it may not be the most efficient way to do it. I can imagine for future a selection of backup method and adjust the rest of the code accordingly. For me the FTP part works well. I did not test if all possible combinations of email/ftp backup and corresponding logic of the code works as expected.

beeyev commented 2 years ago

Hello @BrandonSk sorry for the delay with answer. Thank you for implementing this feature, I will take a look and merge your changes.

BrandonSk commented 2 years ago

Hello @BrandonSk sorry for the delay with answer. Thank you for implementing this feature, I will take a look and merge your changes.

Hi, no problem. I made a "v2" of the FTP feature. It now supports SFTP too. I also made the modifications to the code I suggested above. Now basically you can at the beginning to select if you want to backup to (S)FTP, email, or both. I studied your script and I think the modifications should be fully compatible now. I would already publish it here, but I just installed Sublime Merge and Sublime Text and I am trying to figure out how to get changes from one to another and then to github :) Hopefully on Sunday I will give you much better solution. Cheers.

TerAnYu commented 2 years ago

Пршу прощения что вклиниваюсь, могу дать небольшой набросок, как сделать бэкап всего содержимого корня (очень выручает когда с устройством что-то случается и можно полностью восстановить его функционал, правда это работает только для ftp (не было необходимости отправлять на почту)). https://github.com/TerAnYu/mikrotik_ftp_backup

I apologize for wedging in, I can give a small sketch of how to make a backup of all the content of the root (it is very helpful when something happens to the device and it is possible to completely restore its functionality, although this only works for ftp (there was no need to send to mail)). https://github.com/TerAnYu/mikrotik_ftp_backup

BrandonSk commented 2 years ago

Hello all, I just sent a pull request, so @beeyev you should see that in your repo. If you want to check it out at my fork, here's the link: https://github.com/BrandonSk/Mikrotik-RouterOS-automatic-backup-and-update-With-FTP/tree/ftp_v2

Cheers, Branislav.