I have a C application that spawns children using fork/exec. My spawn-process runs non-stop and it creates a log file using a unix pipe. Every 24 hours I want to backup the logs. For this I’m using a script. Once the script has finished, I want to kill and restart the process. So far so good. But there might be the case that there a still spawned children active. Is it possible to disown them before killing and restarting the spawn process?
Usually, when the parent gets killed, all the children are immediately killed also.
A process doesn’t just die when its parent dies. Most likely, your children processes are receiving some signal (
SIGHUP?) for some reason.If you want your children to persist, you need to find out what that signal is and ignore it right after
fork.