I am writing a daemon in c++ on linux which would launch many processes. I'm considering a scenario when the daemon itself is killed. On restarting the daemon, I would like to kill all other processes launched by this daemon. Ideally I would like all the processes created by this daemon to die if it is killed. I'm considering a scenario when daemon dies after creating the process and without writing onto the log file.
I was wondering if I could use /proc/proc_id/
kind of directories.
But in this case I would like these directories to be created
somewhere in my home directory. So, that I just scan them and
kill these processes. Is it possible ? Or if there is any other solution.
Note: I do not have the access to the source code of any of the child process.