Database Backup Transfer via FTP

This section covers the Meteobridge PRO, PRO2, NANO SD, Raspberry Pi and VM platforms exclusively

Moderator: Mattk

Post Reply
Zedekia
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: Thu Mar 02, 2023 11:34 am

Database Backup Transfer via FTP

Post by Zedekia »

Is it possible to send the database backup via FTP? And if so, how?

Thank you for feedback.

Zedekia
User avatar
Gyvate
Platinum Boarder
Platinum Boarder
Posts: 453
Joined: Thu May 14, 2020 4:36 pm
Location: Saarbrücken, Germany

Re: Database Backup Transfer via FTP

Post by Gyvate »

as far as I know not from within Meteobridge as the backup is made to an external medium (USB device),
but in principle, if you have enough internal space available, you should be able to modify the backup script that it writes the backup into the internal storage. Then you should be able to send it from there via the inbuilt FTP client.

The other option is to mount the external USB stick into the exported file system (what you see as the shared network folder METEOBRIDGE) and save it via copy or ftp from there.
I have an external 2 TB USB disk connected where the backups are written to.
Takes some time until it is filled 8)
Of course this also depends on your backup frequency.
WH4000SE 1.6.6/1 x DP1500/4 x GW1000 1.7.7/GW1100 2.3.0/HP1000SE Pro 1.9.3//2 x WH2650 1.7.7/GW2000 3.1.0
2xMeteobridge Pro [B+R] 15161, 2xRPi4B-2GB/16/32 3139,VM128 1704
Weather Landing page: https://meshka.eu
Ecowitt WiKi: https://meshka.eu/Ecowitt/dokuwiki
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: Database Backup Transfer via FTP

Post by admin »

Backup on PRO2 is located in backup folder of the provided SMB share.
So it is easy for a script on your PC to load the backup from there and to store it wherever preferred. Please delete backup file from the Meteobridge SMB share after that in order to prevent the internal SD card to fill up rapidly.
Mattk
Platinum Boarder
Platinum Boarder
Posts: 1387
Joined: Mon Sep 22, 2014 3:24 am

Re: Database Backup Transfer via FTP

Post by Mattk »

Would creating a new backup script pointing TARGET to the export folder, then triggering FTP and then deleting file from SMB share work?
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: Database Backup Transfer via FTP

Post by admin »

Yes, in general that would work. Downside would be that the FTP job will run long time and Meteobridge does serialize all events to keep system load, RAM footprint etc in close boundaries. That means when a large FTP upload job is triggered all other weather network services etc have to wait for this being completed. Therefore, any FTP backup service should not be part of the regular event handling service of Meteobridge. Most straight forward way might be to define a shell script that gets FTP target data as parameters and that starts a background FTP upload for a previously generated backup file and deletes the local backup file after successful completion. This "backup generation and background FTP upload" script can then be triggered by the existing Meteobridge event mechanism. At least these are my current ideas how to realize this feature...

Any votes to have this implemented?
User avatar
Gyvate
Platinum Boarder
Platinum Boarder
Posts: 453
Joined: Thu May 14, 2020 4:36 pm
Location: Saarbrücken, Germany

Re: Database Backup Transfer via FTP

Post by Gyvate »

even though I'm not owning a MB Pro2 (and don't see a reason to get one having already two (meanwhile legacy) MB Pros and a MB on RPi4 - financial footprint is also a criterion 8) ), I think this would be a usueful feature for new users/owners of a MB Pro2 when FTP is the need and the path via the the exported network share and FTP-ing from there is not walkable.
WH4000SE 1.6.6/1 x DP1500/4 x GW1000 1.7.7/GW1100 2.3.0/HP1000SE Pro 1.9.3//2 x WH2650 1.7.7/GW2000 3.1.0
2xMeteobridge Pro [B+R] 15161, 2xRPi4B-2GB/16/32 3139,VM128 1704
Weather Landing page: https://meshka.eu
Ecowitt WiKi: https://meshka.eu/Ecowitt/dokuwiki
Zedekia
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: Thu Mar 02, 2023 11:34 am

Re: Database Backup Transfer via FTP

Post by Zedekia »

admin wrote: Sat Mar 04, 2023 8:50 am Yes, in general that would work. Downside would be that the FTP job will run long time and Meteobridge does serialize all events to keep system load, RAM footprint etc in close boundaries. That means when a large FTP upload job is triggered all other weather network services etc have to wait for this being completed. Therefore, any FTP backup service should not be part of the regular event handling service of Meteobridge. Most straight forward way might be to define a shell script that gets FTP target data as parameters and that starts a background FTP upload for a previously generated backup file and deletes the local backup file after successful completion. This "backup generation and background FTP upload" script can then be triggered by the existing Meteobridge event mechanism. At least these are my current ideas how to realize this feature...

Any votes to have this implemented?
I tried to transfer the file via a script. But unfortunately that did not work. Here is the script:

#!/bin/bash
HOST=xxx
USER=xxx
PASSWORD=xxx

ftp -inv $HOST <<EOF
user $USER $PASSWORD

lcd /tmp/mnt/data/backup/
cd /xxx/xxxx/


mput *.gz
bye
EOF

What am I doing wrong?
Post Reply