mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-28 07:58:08 +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 --file $FILE --slow-robot 1:3 --skip-confirm"
|
||||
PARAMS="$PARAMS --drop-nth-packet $DROP_N $PLAT_PARMS"
|
||||
# PARAMS="$PARAMS --split-packets 2"
|
||||
# PARAMS="$PARAMS --send-chat 2"
|
||||
# PARAMS="$PARAMS --savefail-pct 10"
|
||||
[ -n "$SEED" ] && PARAMS="$PARAMS --seed $RANDOM"
|
||||
PARAMS="$PARAMS $PUBLIC"
|
||||
|
@ -461,10 +463,13 @@ run_cmds() {
|
|||
ROOM_PIDS[$ROOM]=$PID
|
||||
MINEND[$KEY]=$(($NOW + $MINRUN))
|
||||
else
|
||||
SLEEP=$((${MINEND[$KEY]} - $NOW))
|
||||
[ $SLEEP -gt 0 ] && sleep $SLEEP
|
||||
kill ${PIDS[$KEY]} || true
|
||||
wait ${PIDS[$KEY]}
|
||||
PID=${PIDS[$KEY]}
|
||||
if [ -d /proc/$PID ]; then
|
||||
SLEEP=$((${MINEND[$KEY]} - $NOW))
|
||||
[ $SLEEP -gt 0 ] && sleep $SLEEP
|
||||
kill $PID || true
|
||||
wait $PID
|
||||
fi
|
||||
PIDS[$KEY]=0
|
||||
ROOM_PIDS[$ROOM]=0
|
||||
[ "$DROP_N" -ge 0 ] && increment_drop $KEY
|
||||
|
|
Loading…
Add table
Reference in a new issue