fbpx

Server Setup

FTP backups to remote server

by , , revisited on


We have by far the largest RPM repository with NGINX module packages and VMODs for Varnish. If you want to install NGINX, Varnish, and lots of useful performance/security software with smooth yum upgrades for production use, this is the repository for you.
Active subscription is required.

We all know that regular backups are important. But not all of us do any backups at all. When something breaks, it leads to a great amount of regret about not spending time to setup backups. Let’s learn how to setup FTP backups to remote server.

Some hosting companies provide free backup space. Option varies by the protocol used that you can use for accessing the backup storage. Samba is the best choice. However, some providers limit things to FTP. Below we explain how you can perform FTP backups of complete directory structure.

First, install LFTP utility:

yum install lftp

Then, you can run backup manually like this:

/usr/bin/lftp -e 'mirror —verbose -R /var/www/html /some/ftp/dir; bye;' -u username,password 1.2.3.4

Replace /some/ftp/dir with a directory you created for backups on FTP server, change /var/www/html to local directory that you want to backup. Username and password are FTP credentials of backup space. Replace 1.2.3.4 with IP address or hostname of FTP server.

To run FTP backup daily, simply put as cron job:

@daily /usr/bin/lftp -e 'mirror --verbose -R /var/www/html /some/ftp/dir; bye;' -u username,password 1.2.3.4

This will backup contents of a directory to remote FTP location, once a day.

  1. Lewis Seals

    That is awesome but I use your backup script with a modified rclone script to send to two Hubic drop boxes. Checkout Rclone with a google search.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.