Home > Operation and Maintenance > Linux Operation and Maintenance > rsync regular update configuration method

rsync regular update configuration method

巴扎黑
Release: 2017-07-19 17:06:12
Original
1671 people have browsed it

Attached script

For the three major configuration files, please see rsync installation and configuration

#!/bin/sh
#linuxsir.org home backup 
#/usr/bin/rsync -avzP --password-file=/etc/rsyncd.secrets root@192.168.145.129::test /home/test/$(date +'%s-%m-%d-%y')
/usr/bin/rsync -avzP --password-file=/etc/rsync/rsyncd.secrets root@192.168.145.130::test /home/test/$(date +'%y-%m-%d-%H:%M:%S')
Copy after login

Step one: Create synchronization Script and grant execution permission
cd /etc/rsyncshell/rsyncshell.sh
The content is as follows:
#!/bin/sh
/usr/bin/rsync -avzP --password- file=/etc/rsyncd.secrets root@192.168.145.130::test /home/test/$(date +'%s-%m-%d-%y')

/*Script rsyncshell. I gave it 777 permissions for sh, which is 755 to be precise. Or folder */

Step 2: Create a password file and grant read-only permission
(Here I use /etc/rsyncd.secrets, which is Same as manual synchronization, you can also set a password file yourself) /*I directly quote /etc/rsyncd.secrets

For permissions, chmod 600
*/



Step 3: Modify the configuration file of the crond server
crontab -e Select vim/vi*/
   
   
    Add the following commands:
#     *                                          1 * * * *Root /etc/rsyncshell/rsyncshell.sh
/ *" */1" represents the execution of this script every minute */

## 我 My approach is to directly modify the modification The following file
vim /etc/crontab
Add:*/1 * * * * * root /etc/rsyncshell/rsyncshell.sh
crontab -l You can see the timing just inserted Task



Step 4: Restart the crond server


killall crond Note: Kill the process of the crond server (the process name may be cron)
ps aux |grep crond Note: Check if it is killed
/usr/sbin/crond Note: Start the crond server
ps aux |grep crond Note: Check if it is started

root 3815 0.0 0.0 1860 664? S 14:44 0:00/usr/sbin/crond root 3819 0.0 0.0 2188 808 PTS/1 S+14:45 0:00 GREP CROND # OK

   


Step 5: Success!

The above is the detailed content of rsync regular update configuration method. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template