![]() The cronjob will run at the chosen time and your data sent to the destination server.Ĭongratulations, you’ve just created a simple back up solution from one Linux server to another. You can change that to whatever time you need (in accordance to the crontab time definitions). The above cronjob will run the script at 1 AM daily. Where PATH_TO_RSYNC_FILE is the path housing the rsync script. In the crontab file, add the following to the bottom: Give the new file the proper permissions with the command: In order to successfully make this work, we must create a simple bash script that holds the rsync command. Since rsync does not have a built-in tool for automating the backup process, we need to make use of cron to set this up. Rsync should report back to you that it has successfully backed up the files/folders from the source to the destination ( Figure A). DESTINATION_IP is the IP address of the destination server. The rsync command is an open source utility that provides fast and versatile file transfer and synchronization.SOURCE_DIRECTORY is the directory to be backed up.Rsync -avz SOURCE_DIRECTORY DESTINATION_IP::backup Log in to that server and issue the command: Now we’re going to run a test of the rsync command on the source server. Sudo systemctl restart rsync How to run rsync Restart the rsync service with the command: SOURCE_IP is the IP address of the source server.DESTINATION_DIRECTORY is the directory on the destination server that will house the backup.The first thing we’ll do is configure the destination server. Once installed (on both source and destination hosts), make sure to start and enable the service with the commands: On the off-chance rsync isn’t installed on your system(s), it can be installed with the following command: With those bits at the ready, let’s make this work. Say you want to zip the folder /data/MONDAY and back it up to a remote Linux server. Rsync is available for most every Linux distribution and can be installed from the standard repositories. A nifty trick you could do is zip your folders and then back them up with rsync. I’ll be demonstrating on Ubuntu Server 18.04 (for both source and destination). Two Linux servers (one as a source and one as a destination).SEE: 10 free alternatives to Microsoft Word and Excel (TechRepublic download) What you’ll need I want to walk you through the basics of setting up rysnc to do what it was intended to do–back up a local directory to a remote host. Rysnc is used by a number of GUI front ends and gives every Linux admin plenty of flexibility to do just about any type of back up you need. Rsync is a remote file copying tool that can be used on its own or from within your very own bash scripts. ![]() One of the more tried and true methods is by using the rsync tool. There are countless ways to back up data on the Linux platform.
0 Comments
Leave a Reply. |