我通过首先手动杀死所有子进程来修复脚本。这是差异:
--- /etc/init.d/jetty 2012-05-29 12:59:09.439511236 +0200
+++ jetty.sh 2012-05-29 12:58:13.615513127 +0200 @@ -461,11 +461,23 @@
stop)
echo -n "Stopping Jetty: "
if type start-stop-daemon > /dev/null 2>&1; then
echo $JETTY_PID
+ # FIXME: start-stop-daemon isn't killing child process
+ JETTY_PID_NO=`cat "$JETTY_PID"`
+ for child_pid in `ps -o pid --no-headers --ppid $JETTY_PID_NO`
+ do
+ kill -HUP $child_pid
+ done
start-stop-daemon -K -p"$JETTY_PID" -d"$JETTY_HOME" -a "$JAVA" -s HUP
TIMEOUT=30
while running "$JETTY_PID"; do
if (( TIMEOUT-- == 0 )); then
+ for child_pid in `ps -o pid --no-headers --ppid $JETTY_PID_NO`
+ do
+ kill -KILL $child_pid
+ done
start-stop-daemon -K -p"$JETTY_PID" -d"$JETTY_HOME" -a "$JAVA" -s KILL
fi