mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
kill existing xwords instances as part of --clean-start
This commit is contained in:
parent
8b8d22a7ba
commit
5e22508ff7
1 changed files with 10 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue