I have a service (run by Windows raw_exec) which is connected with a server which is demanding of incoming connections count that’s why I am very interested in not to have extra/stale connections. Another precondition is that the service should support deployment to 1-node/machine environment as well as deployment to a cluster of multiple nodes as we usually do.
In order not to have stale connections, I am preparing a periodic job that will be acting as a garbage collector. The job checks if there are any processes of the service that are not managed by Nomad (e.g. due to some crashes), then kills them. There is a way to achieve this by checking the parent process name which should be “nomad”. But this way is not accurate enough.
Is there a way to get a process id of my raw_exe job via some Nomad API or something like that so that I can get all managed pids and kill all others?