Linux,windows file Synchronization __linux

Source: Internet
Author: User
Tags rsync

Just to work soon, just familiar with the company's a project, the source program on the server, I put the source program down in the Windows Client vs2010 edit, each edit if you want to run and the server to the source program, save the newly modified file to the server, every time feel good trouble. Suddenly remembered to do the file synchronization problem, how to the Windows and Linux files for synchronous processing?

After a search, select Cwrsyn for file synchronization.     Download address: Cwrsyn download. Cwrsync is a file synchronization solution for the Windows platform, Cwrsync packaged rsync and Cygwin,rsync are Linux platform file synchronization software, Cygwin is a Linux simulation environment running on the Windows platform.

1. Cwrsync service-side installation and configuration


1 Download and install cwrsyncserver, download address: http://sourceforge.net/projects/sereds/files/. (Cwrsyn with the above download)


During the installation, a Windows account will be created automatically when the user name and password are created. This account is used to run rsyncserver Windows services (be aware that the account has permissions on the folders to be synchronized), but you can also use the system account to run the service. After the installation is complete, the Rsyncserver service appears in the Administrative Tools service. (Here I show Login failed, I click on the properties of the service, then click Login, select Login as the local user.) )


2 Modify the configuration file rsyncd.conf, the configuration file is as follows: (the main modifications have a and C items, c Select Windows to sync the folder address, the f/test change to your corresponding can)


Use chroot = falsestrict modes = falsehosts Allow = *log File = Rsyncd.loguid = 0gid = 0[test]path =/cygdrive/f/testread only = Falsetransfer logging = Yes configuration file Description:


a The UID = 0,gid = 0 is set for anonymous access so that client synchronization does not require user authentication. If you do not do this, the client synchronizes with a "invalid UID Nobody" or "Invalid GID nobody" error message. If user authentication is required, additional settings will be made.


b) [test] is the equivalent of a virtual directory in which the client synchronizes to access the folder on the server to be synchronized.


c) Path =/cygdrive/f/test, sync the actual path of the folder, F/test=f:\test.


3 Enter the management tool service and start the Rsynserver service.


Note:


A cwrsyncserver the default port is 873, and if you want to specify a port, add it in rsyncd.conf: Port = port number.


b) modified rsyncd.conf to restart the Rsynserver service before it takes effect.


2. Client use method (since Linux with rsync, do not need to install, direct Input command to use.) Rsync-av rsync://192.168.0.58:873/test/cygdrive/h/sync/test, modify the IP address just the Windows end address, the port defaults to 873, and then modify the/cygdrive/h/sync/ Test is the address for the client to sync (mine is Linux, address is/HOME/CHENGG/SRC))


1 Download and install Cwrsyn client, download address: http://sourceforge.net/projects/sereds/files/.


2 synchronous operation via command line:


Assuming the IP of the Cwrsync server is 192.168.0.58, using the default port 873, the virtual directory to be synchronized is test, and the folder where the client synchronizes is H:\sync\test, run the following command to synchronize:


Rsync-av Rsync://192.168.0.58:873/test/cygdrive/h/sync/test
Note: If the server side deletes the file, the client synchronizes without deleting the file and synchronizing only the added and updated files.


3 Create a synchronization batch file and join the task schedule. (Each synchronization needs to enter the above command, if you do not want to be so troublesome, the first time to execute the above command, crontab command, I do not understand.) The second is to set the above command to an alias (the alias command), and enter the alias every time you synchronize--). Look at your requirements need not be scheduled batch processing, at present I only need to compile the above source program only need to use, so I set an alias update, feel also can.


Well, this article is probably here. Most of the above literature is quoted in the Cwrsyn download using the instructions. txt, thanks to this tool. It is a good tool to help people save time.

Come on, work hard.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.