Самба: check file for completeness

I have в device (with Ubuntu on it) with Самба installed. There is also в cron job that скопируй поля out of the Самба share every 60 seconds. I am now running into в situation where the cron job sometimes moves незавершил поля - туз in the file is still being streamed to from over the network. This especially happens when the поля пахал very large.

Is there в way to check for completeness of в file? Or, is there в Самбу setting that will lock the file (keep it from being двиньте) till it is завершил?

0
задан 2 December 2015 в 01:19

1 ответ

Пока передача файлов не завершается, файл будет использоваться (открытый) процессом Samba. Можно протестировать на это посредством эти fuser команда. Таким образом, Ваша команда перемещения была бы чем-то как:

if [[ ! fuser /my/file ]]; then 
    mv /my/file /somewhere/else 
fi 

Это только попытается переместить файл, если файл будет закрыт, что означает, что передача была завершена.

0
ответ дан 30 September 2019 в 02:20

Другие вопросы по тегам:

Похожие вопросы: