N
N
nimod942162020-03-10 16:58:55
Data synchronization
nimod94216, 2020-03-10 16:58:55

How to holistically copy all the files in a bunch from one dir to another, given that the server can fakapnutsya?

Files are periodically generated by the script in the TEMP directory by the cron . The ACT folder contains actual files that are used by people / programs for their own purposes.
How to safely (holistically) update the files after the generation is completed, given that the server may crash / crash the script / etc at the time of copying? Like transactions in a DBMS - either we commit all changes, or nothing / rollback. There should always be full working files at the battle, even though they are old, but most importantly working and of the same version.
Interested in the algorithm and technical capabilities, implementation language or in php or python.

As I see it:
1. begin transaction
2. clear ACT
3. copy files from TEMP to ACT
4. commit

Advanced.
The names of files in folders can be the same, i.e. overwriting maybe, plus old versions of files in battle should not remain after updating, only what was in tempo.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2020-03-10
@Rsa97

We create a new folder, copy the files of the latest version into it, change the working symlink to this folder.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question