2

I have a crontab file with a job that runs a Python script every 5 minutes. The script looks into one folder, checks if there are any files that have been placed in there between last and current runs of the script and if it fins anything, it moves the file into another folder.

Lately, my setup started running into problems where a file that is being moved already exists in the destination folder. I suspect that it could be happening because multiple threads may be spawned off and running the same script at the same time. This would explain the problem.

The first instance finds a file in the source folder and copies it into the destination folder, while the second instance also finds the file and when it tries to copy it to destination folder it finds that a file already exists there. Could anyone please tell me if I am even on the right track with my train of thought and if so, how can I confirm my suspicion and safeguard against such conflict.

Thank you.

0

You must log in to answer this question.

Browse other questions tagged .