3 ms·
Huh okay, then why the sleep?! That kills performance but why'd you do that
by Aachen 3y ago
Huh okay, then why the sleep?! That kills performance but why'd you do that
- tyingq 3y agoNo idea, not my script. Socat does support this kind of syntax, which would seem better suited in this case. socat -v -v TCP-LISTEN:8080,reuseaddr,fork SYSTEM:/some/script It also has a settable max-children so you can put some bounds on it. I did post another comment where I shared my gawk webserver, but I'm not using socat.
- Crestwave 3y agoThe sleep is probably to prevent endless revival of the script when you try to cancel it with Ctrl-C. But yeah, it's not ideal considering you can't make more than one request within a second.
- Aachen 3y agoCould if [ -f /tmp/dontrespawn ]; then break; fi Instead of sleeping, you can create that file when you want it to stop. But perhaps that'd imply that someone would genuinely use this rather than only developing it as a toy
- deleted 3y ago[deleted]