How to wait for file close in Linux

孤街醉人 提交于 2019-12-08 05:13:25

问题


My security cameras recorders (located in distant places), FTP`s to my server video files after any event. Using find and ffmpeg commands, server converts DAV file to AVI and remove DAV file using syntax like this:

find $katalog -type f -name "*.dav" -exec ffmpeg -y -i {} -vcodec libx264 -crf 24 {}.avi >/dev/null 2>&1 \; -exec rm -f {} \;

I use "inotify" to trigger conversion action. The problem is when two or more recorders ftp`s files to server. "inotify" trigger conversion action when first file will be transmitted completely. But other recorders will be still transmit files, so such files will not be closed. How can I modify above syntax to be sure that ffmpeg conversion will be done only on closed (fully transited) files?

来源:https://stackoverflow.com/questions/26077842/how-to-wait-for-file-close-in-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!