build rsync daemon Backup Server
[Email protected] ~]# Rpm-qa rsync
Rsync-3.0.6-12.el6.x86_64
[Email protected] ~]# touch/etc/rsyncd.conf
[Email protected] ~]# vim/etc/rsyncd.conf
#created by yvonne 2015-7-5 21:59:55 ## rsyncd.conf start## uid = rsync gid = rsync use chroot = no max connections = 2000 timeout = 600 pid file = /var/run/rsyncd.pid lock file = /var/run/rsync.lock log file = / Var/log/rsyncd.log ignore errors read only = false list = false hosts allow = 192.168.10.0/24 hosts deny = 0.0.0.0/32 auth users = rsync_backup secrets file = /etc/rsync.password ################### ################## [backup] comment = backup server by yvonne 2015-7-5 22:00:06 path = /backup "/etc/rsyncd.conf" 22l, 696c written
[Email protected] ~]# Mkdir/backup
[Email protected] ~]# Useradd rsync
[[email protected] ~]# ID rsync
uid=500 (rsync) gid=500 (rsync) groups=500 (rsync)
[Email protected] ~]# chown-r rsync/backup/
[Email protected] ~]# ls/backup/
[Email protected] ~]# ll/backup/
Total 0
[Email protected] ~]# ls-ld/backup/
Drwxr-xr-x. 2 rsync root 4096 Jul 5 22:00/backup/
[Email protected] ~]# echo "Rsync_backup:oldboy" >>/etc/rsync.password
[Email protected] ~]# chmod 600/etc/rsync.password
[Email protected] ~]# Ll/etc/rsync.password
-RW-------. 1 root root 5 22:02/etc/rsync.password
[Email protected] ~]# Cat/etc/rsync.password
Rsync_backup:oldboy
[Email protected] ~]# rsync--daemon
[Email protected] ~]#
[Email protected] ~]# vim/etc/rc.local
#!/bin/sh # # This script is executed *after* all and the other init scripts. # You can put your own initialization stuff in here if you don ' t # want to do the full Sys V style init stuff. Touch/var/lock/subsys/local/etc/init.d/iptables Stop rsync--daemon
180 days of data is retained on the backup server, but Friday data is permanently retained:
[Email protected] ~]# vim/server/scripts/reserve.sh
#!/bin/sh #print for reserve backup files in Yvonne 2015-7-5 23:38:34. find/backup/data/-type f-mtime +180-name "*.tar.gz" |xargs RM-RF
[Email protected] ~]#/bin/sh/server/scripts/reserve.sh
[Email protected] ~]# CRONTAB-E
#print for reserve backup files in Yvonne 2015-7-5 23:38:34.
XX * * */bin/sh/server/scripts/reserve.sh >/dev/null 2&>1
[Email protected] ~]# crontab-l
#print for Ntpdate by Yvonne 2015-7-5 09:46:20.
*/5 * * * */bin/sh/server/scripts/ntpdate.sh >/dev/null 2>&1
#print for reserve backup files in Yvonne 2015-7-5 23:38:34.
XX * * */bin/sh/server/scripts/reserve.sh >/dev/null 2&>1
This article is from the "Lanzhi" blog, make sure to keep this source http://7826443.blog.51cto.com/7816443/1704905
Build rsync Daemon Backup server