This article addresses the Windows directory and files to Linux synchronization problem, Windows synchronization to Windows please refer to: http://www.idcfree.com/article-852-1.html
Environment Introduction:
Windows File Server: Windows Server 64bit ip:10.10.3.157
Linux Backup server: Centos 6.4 (64bit) ip:10.10.3.153
Cwrsyncserver version: Cwrsyncserver_4.1.0_installer
The first step:
Configure Cwrsyncserver on Windows Server 2008, the installation is very simple, the next step is complete, note that Cwrsyncserver has a set of user and password place, you have to record, or change to your own user name and password.
For example, administrator password: 123456, this user name and password is required to start the service, that is, your server's user name and password, if you feel insecure, you can consider creating a user name and password in Windows.
Main configuration file: rsyncd.conf
Use chroot = False Strict modes = False hosts allow = *log file = rsyncd.log# Module definitions# Remember Cygwin Naming conventions:c:\work Becomes/cygwin/c/work#[test] #这里我就不改名了, using the default module name path =/cygdrive/d/update #选择路径, This represents the entire e-drive path and does not support Chinese Read only = yes #只读模式transfer logging = Yesuid = 0gid = 0
Step Two:
To start the Cwrsync service:
Right click My Computer--services and applications--Services->rsyncserver-> Right-click Properties--Login for this account enter a valid user name (domain user, user name to have permission to administer e-drive, OH), Password and Confirm the password again; Here I use the domain Administrator account and password (if the user and password do not have permissions or errors, the Rsyncserver service will not start). Start the Rsyncserver service and modify the properties to automatic so that the service is started on subsequent boot.
After the service starts successfully, you can configure the Linux client.
Step Three:
# telnet 10.10.3.157 873 #telnet The port of the Rsync service for Windows Server 2008, which, when connected properly, means that the Rsync service on Windows is OK.
Fourth Step:
Enter the Linux server and create a new fzh_passwd file with the contents of the password I set in Windows Rsyncserver:
# Cd/root
# vi fzh_passwd #再将密码写入些文件中
Dsideal
# chmod fzh_passwd #改下权限, only the root user can see.
Fifth Step:
Synchronize the data from the Windows D drive to the/update/partition:
Yum Install Rsync-y
#rsync-av--progress--delete--password-file=/root/fzh_passwd [email protected]::test/update/
Sixth step:
mkdir/root/backupvi/root/backup/backup_fileserver.sh
Once the synchronization is complete, write this parameter as a shell script and set it to synchronize once per hour
The script reads as follows:
#!/bin/bash#create by fengzehuapassword=/root/fzh_passwdsource= ' 10.10.3.157::test ' USER=AdministratorDEST=/update /echo "Start backup file Server"/usr/bin/rsync-av--progress--delete--password-file= $PASSWORD [email protected]$ SOURCE $DESTif [$?-eq 0] then echo "File Server Backup successfully!" else echo "File server backup failure, try again:" /usr/bin/rsync-av--progress--delete--password-file=$ PASSWORD [email protected] $SOURCE $DESTfi
Then write him to a scheduled task and perform a check every hour.
#crontab-E
* */1 * * */bin/bash/root/backup/backup_fileserver.sh >/dev/null 2>&1
Save after exiting; restart Crond Service
Service Crond Restart
Windows directory and files are synchronized to Linux