I'm going to try to create a one-line bash script that'll do all of the above. I'll likely need some help, as I've only ever created one bash script to date, and it's not even working perfectly yet (I'm still working on it).
Specifically, I'll need a regex method of extracting the parent ID and child ID from:
ps -A -ostat,pid,ppid | grep -e '[zZ]' Z 4900 2800
so I can drop them into the: sudo lldb -p 2800 expr (int)::waitpid(4900, NULL, 0)
... commands.
I envision setting it up so it runs from a keyboard shortcut (as I've done for memory recovery, updates, ZFS SCRUB of the hard drives and clearing old ZFS snapshots), so if there are no zombie processes, it'd note that and exit.
Or it could be set up to run periodically via cron.
You are more advanced than me - I have never scripted. (Except following other tutorials, such as how to extract M$ Licence key for Windows when getting ready for reinstall without having to search for documentation!)