Use cwRsync to implement regular file synchronization (Backup) in windows)

Source: Internet
Author: User

Download the cwRsync server and client software as follows:

Server: cwRsync_Server_2.0.10_Installer

Client: cwRsync_2.0.10_Installer

Then I installed the server (10.0.2.136) on the local machine, and then installed the client on another machine (10.0.2.20.) in the same network segment. For testing, I put the dnt site file of our product on the drive F on the local machine, at the same time, you are ready to use the aspx and config folders in the site folder as the folders for Synchronizing files. Enter the following content in the rsyncd. config file of the server:

Usechroot = false
Strictmodes = false
Hostsallow = *
Logfile = rsyncd. log
Pidfile = rsyncd. pid
Port = 52326
Maxconnections = 4

# Moduledefinitions
# Remembercygwinnamingconventions: c: \ workbecomes/cygwin/c/work
#
[T_aspx]
Path =/cygdrive/f/dnt_snap/aspx
Readonly = false
Transferlogging = yes
Lockfile = rsyncd. lock

[T_config]
Path =/cygdrive/f/dnt_snap/config
Readonly = false
Transferlogging = yes
Lockfile = rsyncd. lock

Note: In the above content, set the listening port to 52326.

In this way, on the control panel --> management tools --> service, locate the service and start it, such:

In this case, we can create a folder named sync on the F disk of the client (10.0.2.20, at the same time, create two folders named "config" and "aspx" respectively below to synchronize the folders on the server.

Then create a batch file named dnt_rsync.bat with the following content:

Rsync-avrsync: // 10.0.2.136: 52326/t_config/cygdrive/f/sync/config
Rsync-avrsync: // 10.0.2.136: 52326/t_aspx/cygdrive/f/sync/aspx

And put it in the bin directory under the cwRsync Client installation directory (my installation directory is as follows: C: \ Program Files \ cwRsync \ bin), and then double-click to start it.

In this way, the file will be synchronized:

Then, we can view the synchronized files in the corresponding current file drive of the client.

Of course, cwRsync uses incremental and modified Synchronization Methods. If you modify the corresponding files on the server, only modified files or new files will be synchronized during synchronization.

The following describes how to create a scheduled task and execute a scheduled synchronization task through the "Task Plan" in windows.

First, click "Control Panel"> "Task Plan"> "add Task Plan" on the client's machine, and click "Next" in the corresponding pop-up window, click "Browse" in the navigation window, as shown below, and select the previously created batch file "dnt_sync.bat ":

At this time, the system will display the following window prompts the execution method of the current scheduled task. Here I select to execute the task every day (once ):

Here, the system will create a task plan named dnt_sync, and prompt the start time of the task in the following window:

Do not make any changes here. Click next, and then perform identity authentication (usually the Administrator). The task is scheduled to run smoothly. You must have sufficient permissions to complete the task :)

Click Finish to create a task plan. However, it is executed by day. What should we do if we want it to be executed once every minute? In fact, it is very simple. Just click the newly created task plan with the mouse, select "properties" in the pop-up menu. In the displayed window, click "advanced" in "Schedule", as shown below:

In this case, a subwindow named "advanced plan options" is displayed, and the following settings are made for others:

By now, this scheduled task will run every minute 24 hours a day to synchronize the previous two folders.

Recently, software was used more time than software development time. As a result, the amount of code developed is not as large as before. However, this type of software is still very useful in application scenarios and may be used in the future. Therefore, I will share this article with you and use it as a "backup.

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.