mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-07 05:24:46 +01:00
for some reason log files are now considered binary by grep, so -a option's needed
This commit is contained in:
parent
5e3f7d0731
commit
e3d6cb74fc
1 changed files with 8 additions and 9 deletions
|
@ -68,7 +68,7 @@ function cleanup() {
|
||||||
|
|
||||||
function connName() {
|
function connName() {
|
||||||
LOG=$1
|
LOG=$1
|
||||||
grep 'got_connect_cmd: connName' $LOG | \
|
grep -a 'got_connect_cmd: connName' $LOG | \
|
||||||
tail -n 1 | \
|
tail -n 1 | \
|
||||||
sed 's,^.*connName: \"\(.*\)\" (reconnect=.)$,\1,'
|
sed 's,^.*connName: \"\(.*\)\" (reconnect=.)$,\1,'
|
||||||
}
|
}
|
||||||
|
@ -356,7 +356,7 @@ maybe_resign() {
|
||||||
if [ "$RESIGN_RATIO" -gt 0 ]; then
|
if [ "$RESIGN_RATIO" -gt 0 ]; then
|
||||||
KEY=$1
|
KEY=$1
|
||||||
LOG=${LOGS[$KEY]}
|
LOG=${LOGS[$KEY]}
|
||||||
if grep -q XWRELAY_ALLHERE $LOG; then
|
if grep -aq XWRELAY_ALLHERE $LOG; then
|
||||||
if [ 0 -eq $(($RANDOM % $RESIGN_RATIO)) ]; then
|
if [ 0 -eq $(($RANDOM % $RESIGN_RATIO)) ]; then
|
||||||
echo "making $LOG $(connName $LOG) resign..."
|
echo "making $LOG $(connName $LOG) resign..."
|
||||||
kill_from_log $LOG && close_device $KEY $DEADDIR "resignation forced" || /bin/true
|
kill_from_log $LOG && close_device $KEY $DEADDIR "resignation forced" || /bin/true
|
||||||
|
@ -397,14 +397,13 @@ check_game() {
|
||||||
CONNNAME="$(connName $LOG)"
|
CONNNAME="$(connName $LOG)"
|
||||||
OTHERS=""
|
OTHERS=""
|
||||||
if [ -n "$CONNNAME" ]; then
|
if [ -n "$CONNNAME" ]; then
|
||||||
if grep -q '\[unused tiles\]' $LOG; then
|
if grep -aq '\[unused tiles\]' $LOG ; then
|
||||||
ALL_DONE=TRUE
|
|
||||||
for INDX in ${!LOGS[*]}; do
|
for INDX in ${!LOGS[*]}; do
|
||||||
[ $INDX -eq $KEY ] && continue
|
[ $INDX -eq $KEY ] && continue
|
||||||
ALOG=${LOGS[$INDX]}
|
ALOG=${LOGS[$INDX]}
|
||||||
CONNNAME2="$(connName $ALOG)"
|
CONNNAME2="$(connName $ALOG)"
|
||||||
if [ "$CONNNAME2" = "$CONNNAME" ]; then
|
if [ "$CONNNAME2" = "$CONNNAME" ]; then
|
||||||
if ! grep -q '\[unused tiles\]' $ALOG; then
|
if ! grep -aq '\[unused tiles\]' $ALOG; then
|
||||||
OTHERS=""
|
OTHERS=""
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
@ -424,11 +423,11 @@ check_game() {
|
||||||
done
|
done
|
||||||
echo ""
|
echo ""
|
||||||
# XWRELAY_ERROR_DELETED may be old
|
# XWRELAY_ERROR_DELETED may be old
|
||||||
elif grep -q 'relay_error_curses(XWRELAY_ERROR_DELETED)' $LOG; then
|
elif grep -aq 'relay_error_curses(XWRELAY_ERROR_DELETED)' $LOG; then
|
||||||
echo "deleting $LOG $(connName $LOG) b/c another resigned"
|
echo "deleting $LOG $(connName $LOG) b/c another resigned"
|
||||||
kill_from_log $LOG || /bin/true
|
kill_from_log $LOG || /bin/true
|
||||||
close_device $KEY $DEADDIR "other resigned"
|
close_device $KEY $DEADDIR "other resigned"
|
||||||
elif grep -q 'relay_error_curses(XWRELAY_ERROR_DEADGAME)' $LOG; then
|
elif grep -aq 'relay_error_curses(XWRELAY_ERROR_DEADGAME)' $LOG; then
|
||||||
echo "deleting $LOG $(connName $LOG) b/c another resigned"
|
echo "deleting $LOG $(connName $LOG) b/c another resigned"
|
||||||
kill_from_log $LOG || /bin/true
|
kill_from_log $LOG || /bin/true
|
||||||
close_device $KEY $DEADDIR "other resigned"
|
close_device $KEY $DEADDIR "other resigned"
|
||||||
|
@ -474,7 +473,7 @@ summarizeTileCounts() {
|
||||||
for KEY in ${KEYS[@]}; do
|
for KEY in ${KEYS[@]}; do
|
||||||
local LOG=${LOGS[$KEY]}
|
local LOG=${LOGS[$KEY]}
|
||||||
|
|
||||||
local LINE=$(grep pool_removeTiles $LOG | tail -n 1)
|
local LINE=$(grep -a pool_removeTiles $LOG | tail -n 1)
|
||||||
if [ -n "$LINE" ]; then
|
if [ -n "$LINE" ]; then
|
||||||
local NUM=$(echo $LINE | sed 's,^.*removeTiles: \(.*\) tiles.*$,\1,')
|
local NUM=$(echo $LINE | sed 's,^.*removeTiles: \(.*\) tiles.*$,\1,')
|
||||||
STR="${STR} ${KEY}:${NUM}"
|
STR="${STR} ${KEY}:${NUM}"
|
||||||
|
@ -482,7 +481,7 @@ summarizeTileCounts() {
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -n "${STR}" ]; then
|
if [ -n "${STR}" ]; then
|
||||||
echo "$(date +%r) tiles left: $STR"
|
echo "** $(date +%r) tiles left: $STR"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue