On Sun, Jan 20, 2013 at 12:04:04PM +0000, Sjon Hortensius wrote: > Hi. I'm trying to create a script which monitors a directory using > inotify and spawns a background process for all events. However I > found that all childs will remain in zombie state until the script > quits and I am unable to find a proper fix. > > A minimal testcase: > > #!/bin/dash > while true > do > sleep 1 & > # jobs >/dev/null > done > > If you open a second terminal you'll see that all the 'sleep' > processes end up being defunct. I have tried playing with `set -ma` > but the only workaround I found is the commented 'jobs' line. > Uncommenting that line will result in expected behavior where childs > are properly reaped. Is this a bug, or is there an alternative > solution I'm missing? You need to wait on them as otherwise dash has to keep them around in case you call wait(1) later on. Cheers, -- Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe dash" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html