mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
test PID is live before killing it
This commit is contained in:
parent
8419bf2a04
commit
5c284fe6b0
1 changed files with 9 additions and 4 deletions
|
@ -204,6 +204,8 @@ build_cmds() {
|
||||||
PARAMS="$PARAMS --game-dict $DICT --port $PORT --host $HOST "
|
PARAMS="$PARAMS --game-dict $DICT --port $PORT --host $HOST "
|
||||||
PARAMS="$PARAMS --file $FILE --slow-robot 1:3 --skip-confirm"
|
PARAMS="$PARAMS --file $FILE --slow-robot 1:3 --skip-confirm"
|
||||||
PARAMS="$PARAMS --drop-nth-packet $DROP_N $PLAT_PARMS"
|
PARAMS="$PARAMS --drop-nth-packet $DROP_N $PLAT_PARMS"
|
||||||
|
# PARAMS="$PARAMS --split-packets 2"
|
||||||
|
# PARAMS="$PARAMS --send-chat 2"
|
||||||
# PARAMS="$PARAMS --savefail-pct 10"
|
# PARAMS="$PARAMS --savefail-pct 10"
|
||||||
[ -n "$SEED" ] && PARAMS="$PARAMS --seed $RANDOM"
|
[ -n "$SEED" ] && PARAMS="$PARAMS --seed $RANDOM"
|
||||||
PARAMS="$PARAMS $PUBLIC"
|
PARAMS="$PARAMS $PUBLIC"
|
||||||
|
@ -461,10 +463,13 @@ run_cmds() {
|
||||||
ROOM_PIDS[$ROOM]=$PID
|
ROOM_PIDS[$ROOM]=$PID
|
||||||
MINEND[$KEY]=$(($NOW + $MINRUN))
|
MINEND[$KEY]=$(($NOW + $MINRUN))
|
||||||
else
|
else
|
||||||
SLEEP=$((${MINEND[$KEY]} - $NOW))
|
PID=${PIDS[$KEY]}
|
||||||
[ $SLEEP -gt 0 ] && sleep $SLEEP
|
if [ -d /proc/$PID ]; then
|
||||||
kill ${PIDS[$KEY]} || true
|
SLEEP=$((${MINEND[$KEY]} - $NOW))
|
||||||
wait ${PIDS[$KEY]}
|
[ $SLEEP -gt 0 ] && sleep $SLEEP
|
||||||
|
kill $PID || true
|
||||||
|
wait $PID
|
||||||
|
fi
|
||||||
PIDS[$KEY]=0
|
PIDS[$KEY]=0
|
||||||
ROOM_PIDS[$ROOM]=0
|
ROOM_PIDS[$ROOM]=0
|
||||||
[ "$DROP_N" -ge 0 ] && increment_drop $KEY
|
[ "$DROP_N" -ge 0 ] && increment_drop $KEY
|
||||||
|
|
Loading…
Add table
Reference in a new issue