Page 1 of 1

Database Backup Transfer via FTP

Posted: Fri Mar 03, 2023 10:04 pm
by Zedekia
Is it possible to send the database backup via FTP? And if so, how?

Thank you for feedback.

Zedekia

Re: Database Backup Transfer via FTP

Posted: Fri Mar 03, 2023 10:26 pm
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.

Re: Database Backup Transfer via FTP

Posted: Sat Mar 04, 2023 1:28 am
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.

Re: Database Backup Transfer via FTP

Posted: Sat Mar 04, 2023 1:47 am
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?

Re: Database Backup Transfer via FTP

Posted: Sat Mar 04, 2023 8:50 am
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?

Re: Database Backup Transfer via FTP

Posted: Sat Mar 04, 2023 12:05 pm
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.

Re: Database Backup Transfer via FTP

Posted: Sun Mar 05, 2023 2:49 am
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?