On Tue, Jun 21, 2016 at 8:45 PM, Thomas Lau <[email protected]> wrote: > So what you are trying to say is that we should check PID from program side > instead of depending on runsv, correct? > No, I'm saying you should do something in your run script like: ... previous script part ... PID=`netstat -antp | grep 0.0.0.0:11211 | awk '{print $7}' | cut -d/ -f 1 if [ ! $PID = "" ]; then kill $PID ; done ... rest of script ...
It's not perfect because theoretically memcached could exit after $PID is set but before the test and the process ID recycled but it's pretty unlikely, and it's definitely not pretty. In _almost_ any situation the above is unnecessary but if you're in a situation where you're getting your runsv's killed then this might be necessary. That said, it would behoove you to find out why you're regularly getting your system into a degenerate state that's killing off runsv instances but not killing the supervised process. runsv and runsvdir are remarkably resilient processes, so there's definitely something bad going on with your systems. Cheers! -Colin -- "If the doors of perception were cleansed every thing would appear to man as it is, infinite. For man has closed himself up, till he sees all things thru' narrow chinks of his cavern." -- William Blake
