This question is a bit more specific than related questions because of the following requirements:
- I need a program to run when a new file is added to a folder using scp.
- The file can only have a specific file extension
.ssml
. - The file name has to be used as an argument.
./sabdfl popey.ssml
- Files will be rapidly added to the folder on a threaded machine, and so multiple instances of the program will have to be added. Obviously I will need to prevent execution of two instances on the same file. The file gets deleted by the program after its finished executing.
- However, no more than
n
number of instances can be running at once, to ensure a thread is always free for running the machine. - The execution must halt when the server starts running out of physical drive space.
What is the best way to go about this on Ubuntu?
systemd service
;)... – George Udosen Mar 22 '17 at 08:51inotifywait
: https://askubuntu.com/questions/541128/monitor-folder-contents-changes – ridgy Mar 22 '17 at 12:05man 7 inotify
) to create a threaded program. – ridgy Mar 22 '17 at 12:31