I have a video encoding script that I would like to run as soon as the file is moved to a specific directory.
If I use something like inotify, how can I guarantee that the file is not encoded before it is moved?
I thought of doing something like:
- Copy the (rsync) file to a temporary directory.
- After completion, move (a simple "mv") to the encoding directory.
- Ask my script to track the encoding directory.
However, how can I make step # 2 work correctly and run only once when # 1 is complete?
I am using Ubuntu Server 11.10 and I would like to use bash, but I could convince you to use Python if this simplifies the problems.
I do not βuploadβ files to this directory on my own; rather, I will use rsync the vast majority of the time.
In addition, this Ubuntu server runs on a virtual machine.
I have my main file repository mounted via NFS from a FreeBSD server.
source share