in reply to monitor a process's state.
...Also, here our parent may have been completed.
You could have the children write various status info to log files in a directory, e.g. with the files containing the PID in their names. At a minimum, you'd need a heartbeat message (say a timestamp, printed every minute or so, as long as everything is running ok), and a "finished" status message.
Something else (e.g. a cronjob) could then periodically scan this directory, check the files for out-of-date heartbeat timestamps, not being followed by "finished" (which would indicate that the process hangs or somehow disappeared), etc., create a summary report, and do the cleanup of the files associated with finished jobs.
Of course, this would only work if the children's code is under your control, so you can modify it to print heartbeats, etc.
|
|---|