Acting as a shell job, writing for UNIX, Linux, and writing foreign shell jobs

Source: Internet
Author: User

Acting as a shell job, writing for UNIX, Linux, and writing foreign shell jobs
This project is designed to create a file synchronizer.
1.1 Introduction
Many computer users want to access their files from different machines, the most convenient way is to use a single file system, the file system through the network of multiple machines installed. When the machine is on a different network, the files shared by the system cannot be easily used. For example, a user with two machines (portable and desktop) has the same file, when a portable machine file is changed, and it is not connected to the network at this time, then it must manually copy the new version to the system (this system contains only the old version of the file), when the file is changed in both systems , the operation becomes complex and produces many errors.
File synchronization software is an automatic generation of two identical file trees, as much as possible to produce results that meet user expectations. The goal of this project is to write a software like this.
1.2 Features
The purpose of the Synchronizer is to be as close as possible to the same state of tree A and tree B, that is, if the file is a (p/a) of P, the presence of P's B (recorded as p/b) also exists and is the same (data and metadata), and vice versa. We are referring to the type of metadata, the permissions of the file p, the size of the file P, and the last modification date of the file p.
In general, if a file is modified on both sides, it is not possible to achieve a full synchronization, we will say that there is a conflict between the two versions of the file. The file Synchronizer processes two file trees, we will call A and B, and the last successful synchronization log containing the file, which is stored in the $home/.synchro, contains path A and path B, and for each file p/a =p/b, synchronized without conflict, The log file contains its path, its file type and permissions, the size of p, and the date of the last modification.
We say that there is an entry for P in the log file, and that the file p/a (or p/b) has the same pattern, size, and last modified date (those stored in the journal), then the file p/a (or p/b) is a log-compliant

1.3 Simple synchronization
The Synchronizer runs two of trees A and b in parallel, and for all P files, it does the following:
-If p/a is a directory and p/b is a normal file, then there is a conflict.
-otherwise, if both p/a and p/b are directories, it will drop recursively.
-otherwise, if p/a and p/b are two ordinary files and have the same pattern, size, and modification date, then the synchronization succeeds, then nothing is done.
-otherwise, if the p/a is consistent with the log file and p/b is inconsistent with the log file, the latter one has changed to copy all p/b information to p/a.
Conversely, if the p/b is consistent with the log file and p/a is inconsistent with the log file, copy all p/a information to p/b.
-Finally, if p/a and p/b are normal files, and none of them are two compliant with the log file (perhaps because the log file does not have a P entry, perhaps because it does not match the metadata of the two files) then there is a conflict.
The Synchronizer then overwrites the log file with data from all the normal files that were successfully synchronized.
It is important to note that the file order in both trees is not necessarily consistent, and a May contain files P and q,b that may contain the file Q and P, which you decide how to handle the conflict. We can just display a list of conflicts once. We can ask the user to make a choice, and if these files are text files, we can show the differences between the two files (for example, using the command diff)

1.4 Synchronizer with content comparison
If a file has the same modifications on both sides, there is a misleading conflict between the above Synchronizer. When there is a conflict with two ordinary files, the Synchronizer that contains the content comparison will drill down and compare the contents of the two files to see if they really conflict.
-If the metadata of two files is the same, then nothing can be done, synchronization is successful;
-If the metadata of one file in two files is the same as that stored in the log, then the metadata of the other file is changed, then only the metadata of the first file can be changed, and the synchronization will be successful.
-If the metadata for two files is different, these two files are conflicting, but are limited to metadata. They may be useful, which needs to be known to the user;
Of course, when any of the above synchronization successes occurs, the results need to be stored in the log file.

2. Expansion
All relevant extensions are welcome. For example, we can think of managing symbolic links (the user can dereference or synchronize the link itself)
The user interface is at your own discretion. In particular, when a conflict occurs, we can consider implementing a user-friendly interface. For example, suggest whether to start a tool for calculating differences. (TXT file) We can also consider how to handle a possible crisis situation: Tree A and tree b change during synchronization.
3. Details
To simplify the implementation of this project, the Synchronizer will only be developed to perform synchronization of the 2 file systems of the same machine.

Our Direction field: Window Programming numerical algorithm AI Artificial Intelligence financial statistical Metrology analysis Big Data network programming Web programming Communication Programming game Programming Multimedia Linux plug-in programming API image processing embedded/Microcontroller database programming console process and thread Network security assembly language Hardware programming software Design Engineering Standard Rules. The generation of programming languages or tools including, but not limited to, the following ranges:

C/c++/c# Write

Java Write generation

It generation

Python writes

Tutoring Programming Jobs

The MATLAB Generation writes

Haskell writes

Processing Write

Linux Environment Setup

Rust Generation Write

Data Structure assginment Data structure generation

MIPS Generation Writing

Machine Learning Job Writing

Oracle/sql/postgresql/pig database Generation/Generation/Coaching

Web development, Web development, Web site jobs

Asp. NET Web site development

Finance insurace Statistics Statistics, regression, iteration

Prolog write

Computer Computational Method Generation

Because of professional, so trustworthy. If necessary, please add qq:99515681 or e-mail:[email protected]

: Codinghelp

Acting as a shell job, writing for UNIX, Linux, and writing foreign shell jobs

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.