I have a basic question which I need help with.
We have a use-case where we want to spawn a process in a different session/process-group i.e. if the parent spawning the process gets a SIGTERM, the child doesn't get the signal (or get killed).
Although we want to kill this process (and its children) the next time we have to spawn the same process. To achieve this goal, we want to keep track of the process-id. I won't prefer to store it on disk as that could cause an issue where the process-id is not saved and we fail to kill it the next time.
What are the ways to achieve the following?
1. Launch a separate process which doesn't get SIGTERM when the parent receives it - I think exec can solve this problem.
2. Keep track of the process and kill it before re-launching it - I think we can launch the process with a name but that doesn't seem like a clean way as it overrides the actual name.
Asked by instanceOfObject
(111 rep)
Jul 22, 2019, 09:02 AM