How to spawn slow / background commands from cf-agent? #4504
-
I'm writing some policy that will spawn I want to spawn quite a few of these, in parallel, and sometimes they will take several minutes to complete. I definitely want to keep running The command will be like this:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You can background the promise, which lets other promises go ahead and run, cf-agent won't terminate until the promises finish.
Those backgrounded promises should still hold the lock, so concurrent runs of cf-agent should skip running the same command for that where the lock is held. |
Beta Was this translation helpful? Give feedback.
-
Alternatively, you can detach the commands from the agent run, but if you do this cf-agent won't be tracking anything at all about the result of the commands.
|
Beta Was this translation helpful? Give feedback.
Alternatively, you can detach the commands from the agent run, but if you do this cf-agent won't be tracking anything at all about the result of the commands.
For that, there is a
daemonize
bundle in the stdlib you may find helpful.