I've been recently doing the following:
ssh uid@somemachine -- someRelativelyLongCommand
This works fine, however,
- The number of ssh sessions per machine are limited (10 by default, not sure what upper bound here is)
- This maintains sessions open, meaning that if something happens to host machine, session, and cmd with it, dies
Would be interesting to know what alternative would, for example, spawn command on the remote machine + give pid back. Periodically check for that process' state, and once done, mark it as finished.
It feels there should be a bash way to achieve this and not resort to e.g., some kind of distributed scheduler environment, which is most likely an overkill for the use case considered (things work fine, it just seems they are sub-optimal).
Thanks!