Backups using LFTP
This guide explains how to perform backups from server_1 to server_2 using FTP. Here we are assuming that that server_2 has an FTP server running and server_1 is performing the backup.
- Make sure you have lftp installed.
- Create an FTP user on server_2 and give them a chroot’d home directory.
- Create a script file that lftp will use as a set of instructions:
#!/bin/bash lftp -c "set ftp:listoptions -a; open ftp://username:password@hostname; lcd /path/to/local/directory/on/server_1; cd /path/on/ftp; mirror --reverse --delete --verbose
- Create a shell script to execute the backup:
#!/bin/bash lftp -f /root/cron/lftp.script
- Add the command to crontab:
# Executes at 3am 0 3 * * * nice 19 /root/cron/backup.sh >> /root/cron/logs/backup.log 2>&1