Linux vps automatically backs up remote servers to establish mirror sites

Linux vps automatically backs up remote servers to establish mirror sites

Most Linux VPS use rsync to synchronize and back up the website to another VPS. There are many rsync tutorials on the Internet. I also took a look at it and still think it is too complicated and not easy for novices to get started. I did some research yesterday and found a simple way to automatically back up a remote server and establish a mirror site. The method used is based on a previous article on simple website migration using vps. Simply use a script to automatically back up the website every day.
Below we take the backup of the master server 1.1.1.1 to the slave server 2.2.2.2 as an example.
1. Log in to ssh from server 2.2.2.2
2. Create a new copy.sh command in the /etc/cron.daily directory as follows:

vi /etc/cron.daily/copy.sh

3. To edit the content, press the letter "i" first. When "–INSERT–" appears in the lower left corner, copy the following content.

#!/bin/bash
cd /home/admin/o51k.com

 wget -nH --cut-dirs=1 -m --ftp-user=o51k --ftp-password=o51k ftp://o51k.com/o51k.com

Note: cd /home/admin/o51k.com is the directory of the slave server 2.2.2.2. The first o51k in the third line is the ftp user of the primary server 1.1.1.1. The second o51k is the ftp password of the primary server 1.1.1.1. ftp://1.1.1.1/o51k.com Here o51k.com is the directory of the website to be backed up.
4. After copying and pasting the above content, press "Esc", then press ":" colon, and then enter "wq". Press Enter to complete.
5. Add permissions to the script. The command is as follows:

chmod 755 /etc/cron.daily/copy.sh

6. Use the system crontab to run automatically every day: the command is as follows

crontab -e

7. To edit the content, press the letter "i" first. When "–INSERT–" appears in the lower left corner, copy the following content.

30 3 * * * /etc/cron.daily/copy.sh

After copying and pasting the above content, press "Esc", then press ":" colon, and then enter "wq". Press Enter to complete. That is, automatically back up the website to establish a mirror site from the server at 3:30 every day.
Note: This method does not back up the database. In general it is much simpler than rsync, but the directory permissions are not synchronized with the main server. You have to change the permissions manually.
Reposted from First Encounter. The Other Shore http://o51k.com/

<<:  MEID free .edu mailbox

>>:  knProxy — Free PHP proxy program

Recommend

simplecloud: $3.6/month/1GB RAM/20GB SSD/unlimited traffic/KVM/Russia

simplecloud.ru, a Russian hosting provider, has i...

[Black Friday] Servdiscount: 10% off on German dedicated servers

servdiscount is a long-established German hosting...

DeinServerHost: €1.95/month/512MB memory/12GB space/1TB traffic/KVM/Germany

DeinServerHost, a German hosting provider, was es...

10Gbps port dedicated server recommendation

1. fdcservers It has its own computer room and ma...

BudgetVZ: $4.52/year/1 core/128MB memory/10GB space/500GB bandwidth/OpenVZ

Recently, low-priced VPSs are everywhere, and ano...

StableHost registration and renewal discount code

StableHost first-time purchase discount code: Lon...

OLink Cloud 1GB RAM 1Gbps Bandwidth Germany Direct KVM VPS Review

Details : OLink Cloud: $3.5/month/1GB memory/10GB...

MagpieHost: $12/year/5GB space/200GB traffic/dedicated IP/Los Angeles

MagpieHost is a newly established hosting provide...

AlphaVPS: €20/month/2*L5630/16GB RAM/1TB HDD/5TB traffic/Romania

AlphaVPS, a Bulgarian hosting provider, was estab...