Author: soliton
Date: Thu Mar 27 01:45:08 2008
New Revision: 25175

URL: http://svn.gna.org/viewcvs/wesnoth?rev=25175&view=rev
Log:
* rename gmon.out when the server terminates
* add some error messages

Modified:
    trunk/utils/mp-server/run_server

Modified: trunk/utils/mp-server/run_server
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/mp-server/run_server?rev=25175&r1=25174&r2=25175&view=diff
==============================================================================
--- trunk/utils/mp-server/run_server (original)
+++ trunk/utils/mp-server/run_server Thu Mar 27 01:45:08 2008
@@ -11,15 +11,18 @@
 SOURCE=$HOME/source/trunk
 THREADS=4
 
+if ! [ -d "$SERVERBASE" ]; then
+       echo "Server '$SERVER' not found."
+       exit 1
+fi
+[ -d "$SERVERBASE/logs" ] || mkdir $SERVERBASE/logs
+
 case $SERVER in
        1.2 )   SOURCE=$HOME/source/1.2
                THREADS=30
                ;;
        * )
 esac
-
-[ -d "$SERVERBASE/logs" ] || mkdir $SERVERBASE/logs
-[ -d "$SERVERBASE" ] || exit 1
 
 ulimit -Ss 2048
 ulimit -c unlimited
@@ -36,7 +39,10 @@
                PORT=$(cat $SERVERBASE/port)
                REV=$(ls -l $SERVERBASE/build | sed -e 
's,.*wesnothd-\(svn-.*\)_.*/,\1,')
                cd $SERVERBASE/build || exit 1
-               [ -x bin/wesnothd-$SERVER ] || exit 1
+               if ! [ -x bin/wesnothd-$SERVER ]; then
+                       echo "Executable 'bin/wesnothd-$SERVER' not found."
+                       exit 1
+               fi
                nice -n 3 bin/wesnothd-$SERVER -c $SERVERBASE/wesnothd.cfg 
--port $PORT --threads $THREADS $PARAMETERS > 
$SERVERBASE/logs/wesnothd.$DATE.$REV.log 2>&1 &
                PID=$!
                echo -n "started $SERVER server (revision: $REV, pid: $PID) at: 
"; date
@@ -46,15 +52,15 @@
                mv currentlobby.log oldlobby.log > /dev/null 2>&1
                ln -s logs/wesnothd.$DATE.$REV.log current.log
                ln -s logs/lobby.$DATE.$REV.log currentlobby.log
-               mv gmon.out gmon.$DATE.out > /dev/null 2>&1
                # wait a bit so the server is likely up and listening
                sleep 1
                if [ "$SERVER" == "1.2" ]; then
                        cd $SOURCE/utils/
                        ./mp-lobby-logger.pl -j -p $PORT -l 
$SERVERBASE/currentlobby.log >> $SERVERBASE/logs/lobby-chat.log 2>&1 &
+                       cd $SERVERBASE/build
                fi
                # wait for the server to terminate
                wait $PID
-               cd
+               mv gmon.out gmon.$DATE.$REV.out > /dev/null 2>&1
        fi
 done


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to