mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-02 06:20:14 +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
|
LOGDIR=$(basename $0)_logs
|
||||||
APP_NEW=""
|
APP_NEW=""
|
||||||
|
DO_CLEAN=""
|
||||||
APP_NEW_PARAMS=""
|
APP_NEW_PARAMS=""
|
||||||
NGAMES=""
|
NGAMES=""
|
||||||
UPGRADE_ODDS=""
|
UPGRADE_ODDS=""
|
||||||
|
@ -41,6 +42,12 @@ declare -a DICTS
|
||||||
declare -A CHECKED_ROOMS
|
declare -A CHECKED_ROOMS
|
||||||
|
|
||||||
function cleanup() {
|
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...."
|
echo "cleaning everything up...."
|
||||||
rm -f $(dirname $0)/../../relay/xwrelay.log
|
rm -f $(dirname $0)/../../relay/xwrelay.log
|
||||||
rm -rf ${LOGDIR}
|
rm -rf ${LOGDIR}
|
||||||
|
@ -549,7 +556,7 @@ function usage() {
|
||||||
while [ "$#" -gt 0 ]; do
|
while [ "$#" -gt 0 ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
--clean-start)
|
--clean-start)
|
||||||
cleanup
|
DO_CLEAN=1
|
||||||
;;
|
;;
|
||||||
--num-games)
|
--num-games)
|
||||||
NGAMES=$(getArg $*)
|
NGAMES=$(getArg $*)
|
||||||
|
@ -633,6 +640,8 @@ done
|
||||||
[ -n "$SEED" ] && RANDOM=$SEED
|
[ -n "$SEED" ] && RANDOM=$SEED
|
||||||
[ -z "$ONEPER" -a $NROOMS -lt $NGAMES ] && usage "use --one-per if --num-rooms < --num-games"
|
[ -z "$ONEPER" -a $NROOMS -lt $NGAMES ] && usage "use --one-per if --num-rooms < --num-games"
|
||||||
|
|
||||||
|
[ -n "$DO_CLEAN" ] && cleanup
|
||||||
|
|
||||||
RESUME=""
|
RESUME=""
|
||||||
for FILE in $(ls $LOGDIR/*.{xwg,txt} 2>/dev/null); do
|
for FILE in $(ls $LOGDIR/*.{xwg,txt} 2>/dev/null); do
|
||||||
if [ -e $FILE ]; then
|
if [ -e $FILE ]; then
|
||||||
|
|
Loading…
Reference in a new issue