Pages

File Copy Behavior w/o File Locks

mardi 9 août 2016

It's my understanding that, without additional software, Linux doesn't have a concept of locks on open files.

I'm creating a cron job that will periodically copy all files in a Linux directory (call it the "source" directory) to some other Linux directory (call it the "destination" directory), remove the files in the "source" directory, and then do some things with the files in the "destination" directory.

The "source" directory is a writable, networked share accessible by several Windows machines.

The Windows machines will write files to this "source" directory periodically, but the timing and length of time required to do the copy is unpredictable.

I am wondering what will happen if the cron job executes and a file in the "source" directory is in the process of being created, i.e., it is being written by a Windows machine and the process isn't complete.

What is Ubuntu's copy command behavior in this circumstance? Will it wait, skip over the file, or copy an incomplete file?
Likewise, what is the behavior when the remove command is executed and it encounters a file in the process of being written?

Thanks.

Let's block ads! (Why?)



File Copy Behavior w/o File Locks

Aucun commentaire:

Enregistrer un commentaire