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

AlphaRacks: $2.99/year/64MB/2GB space/100GB traffic/OpenVZ/Los Angeles

AlphaRacks has been introduced many times. I own ...

cloud4box: $1.3/month/256MB RAM/3GB SSD space/unlimited traffic/KVM/Russia

cloud4box, a Russian hosting provider, seems to h...

HiFormance: $10/month/4G memory/150GB space/2TB traffic/KVM/Los Angeles

HiFormance, an American hosting company located i...

£5.99/month/128M/20G space/250G traffic/Xen VPS —— Evorack

Evorack is a British hosting company under ABPNI ...

HostMyBytes 1GB RAM Los Angeles OpenVZ VPS Review

Details: HostMyBytes: $5/year/128MB RAM/10GB stor...

Use iptables port forwarding to improve network access speed

First reference : Brook/iptables port forwarding ...

Vultr installation tutorial for Windows system

Vultr details: Vultr: $2.5/month/512MB memory/20G...

[Black Friday] Blesta: Lifetime license, $550; annual payment $180

Blesta, like whmcs, is a relatively well-known ho...