Systemd path unit pile-up
Posted: 2020/01/01 00:15:07
I'm wondering (and I can test this, but I was hoping the gurus on the board might have some words of wisdom) what happens when a systemd path unit calls it's related service unit and then another file shows up that meets the criteria of the path unit (using a PathExistsGlob directive) while the program executed by the service unit is still running? Does it run another copy of the program or does it wait until the .service called has finished it's business before starting the process again from the top?
The reason I'm asking is I'm envisioning a path unit watching a file delivery folder from a downstream system where 3 related files will be delivered at a time. Once the path unit realizes that new files have arrived, it will move the files into a processing folder and then do some stuff with them which will take an undetermined amount of time. Once it's done processing them, it will archive them and go back to sleep waiting for the next file set. This work fine for a small number of downstream systems delivering file sets, but once I start to ramp up, I envision that while the program called by the service unit is working on one file set, another file set may be delivered to the file delivery folder and I want to either avoid processing it until the first file set it processed, OR (if the path unit will have the service unit run the processing program immediately whether I like it or not) is there anything I can pass to the service and on to the program from the path unit as to the names of the discovered files so the instance of the program called by the service unit knows to only work on ITS files and not the ones also in the processing folder and already being worked on by a prior instance of the processing program.
Alternatively, if this problem has already been solved by a pre-packaged application in the linux repos that I can install and configure, I'd love to hear about it, but I haven't been able to find anything that fits, thus far.
Thanks,
Scott
The reason I'm asking is I'm envisioning a path unit watching a file delivery folder from a downstream system where 3 related files will be delivered at a time. Once the path unit realizes that new files have arrived, it will move the files into a processing folder and then do some stuff with them which will take an undetermined amount of time. Once it's done processing them, it will archive them and go back to sleep waiting for the next file set. This work fine for a small number of downstream systems delivering file sets, but once I start to ramp up, I envision that while the program called by the service unit is working on one file set, another file set may be delivered to the file delivery folder and I want to either avoid processing it until the first file set it processed, OR (if the path unit will have the service unit run the processing program immediately whether I like it or not) is there anything I can pass to the service and on to the program from the path unit as to the names of the discovered files so the instance of the program called by the service unit knows to only work on ITS files and not the ones also in the processing folder and already being worked on by a prior instance of the processing program.
Alternatively, if this problem has already been solved by a pre-packaged application in the linux repos that I can install and configure, I'd love to hear about it, but I haven't been able to find anything that fits, thus far.
Thanks,
Scott