Maybe you should try running your hcicmd command in the background. Try adding an “&” at the end of the exec command. “hcicmd” is a way to send commands to the command thread of your process. But if the process is waiting for the tps proc to complete then the command thread will never be able to receive the command. Of course you’ll have no way to write error handling code in your TPS proc because that proc must return before the thread shutdown is issued.
I would probably avoid this method of handling the problem. Why not just have your UPOC check every few minutes all day long? You could set up some kind of alert if you don’t pick up the file at the expected time and keep trying. You could use just one thread for handling the file regardless of whether it was created manually or automatically.