kill existing xwords instances as part of --clean-start

This commit is contained in:
Eric House 2013-06-21 06:58:20 -07:00
parent 8b8d22a7ba
commit 5e22508ff7

View file

@ -3,6 +3,7 @@ set -u -e
LOGDIR=$(basename $0)_logs
APP_NEW=""
DO_CLEAN=""
APP_NEW_PARAMS=""
NGAMES=""
UPGRADE_ODDS=""
@ -41,6 +42,12 @@ declare -a DICTS
declare -A CHECKED_ROOMS
function cleanup() {
APP="$(basename $APP_NEW)"
while pidof $APP; do
echo "killing existing $APP instances..."
killall -9 $APP
sleep 1
done
echo "cleaning everything up...."
rm -f $(dirname $0)/../../relay/xwrelay.log
rm -rf ${LOGDIR}
@ -549,7 +556,7 @@ function usage() {
while [ "$#" -gt 0 ]; do
case $1 in
--clean-start)
cleanup
DO_CLEAN=1
;;
--num-games)
NGAMES=$(getArg $*)
@ -633,6 +640,8 @@ done
[ -n "$SEED" ] && RANDOM=$SEED
[ -z "$ONEPER" -a $NROOMS -lt $NGAMES ] && usage "use --one-per if --num-rooms < --num-games"
[ -n "$DO_CLEAN" ] && cleanup
RESUME=""
for FILE in $(ls $LOGDIR/*.{xwg,txt} 2>/dev/null); do
if [ -e $FILE ]; then