send error messages to STDERR

get the server port from the redirect.cfg (which needs to be changed anyway)
This commit is contained in:
Gunter Labes 2008-04-26 18:10:52 +00:00
parent b07b80147a
commit 7fa4661094
6 changed files with 33 additions and 30 deletions

View file

@ -6,7 +6,7 @@ else
echo=""
fi
if ! [ $# -ge 1 ]; then
echo "Syntax: $0 [-n] <new minor version>"
echo "Syntax: $0 [-n] <new minor version>" >&2
exit 1
fi
[ $1 -ge 1 ] || exit 1
@ -31,14 +31,14 @@ $echo sed -i -e "/motd=/s/$PREV_VERSION/$NEW_VERSION/g" $PREV_SERVER_CONFIG
$echo killall -SIGHUP wesnothd-$DEV_VERSION-prev || exit 1
# check if we currently allow the previous version to prevent announcing the same version twice
if ! [ $(grep "versions_accepted=.*$PREV_VERSION" $DEV_SERVER_CONFIG) ]; then
echo "Previous version $PREV_VERSION currently not allowed. Announcing the right version? Aborting..."
echo "Previous version $PREV_VERSION currently not allowed. Announcing the right version? Aborting..." >&2
exit 1
fi
$echo sed -i -e "/versions_accepted=/s/$PREV_VERSION/$NEXT_VERSION/" $DEV_SERVER_CONFIG
$echo sed -i -e "/motd=/s/$PREV_VERSION/$NEW_VERSION/g" $DEV_SERVER_CONFIG
# update previous version redirect
$echo sed -i -e "/\[redirect\]/N;/version=/s/$PPREV_VERSION/$PREV_VERSION/" $PREV_SERVER_REDIRECT
$echo sed -i -e "s,#{./$DEV_VERSION-prev-redirect.cfg},{./$DEV_VERSION-prev-redirect.cfg}," $DEV_SERVER_CONFIG
$echo sed -i -e "s,#\({./$DEV_VERSION-prev-redirect.cfg}\),\1," $DEV_SERVER_CONFIG
# reload the config
$echo killall -SIGHUP wesnothd-$DEV_VERSION wesnothd-trunk || exit 1
$echo send_server_command $DEV_VERSION msg Version $NEW_VERSION has been released! New users with the previous version will now get redirected to a temporary server that will run until binaries for all major OSs are out.
$echo $HOME/bin/send_server_command $DEV_VERSION msg Version $NEW_VERSION has been released! New users with the previous version will now get redirected to a temporary server that will run until binaries for all major OSes are out.

View file

@ -1,6 +1,6 @@
#!/bin/sh
if ! [ $# -eq 1 ]; then
echo "Syntax: $0 <server version>"
echo "Syntax: $0 <server version>" >&2
exit 1
fi
@ -8,7 +8,7 @@ SERVER=$1
SERVERBASE=$HOME/servers/$SERVER
if ! [ -d $SERVERBASE ]; then
echo "$SERVER server not found."
echo "$SERVER server not found." >&2
exit 1
fi

View file

@ -1,6 +1,6 @@
#!/bin/sh
if [ $# -lt 1 ]; then
echo "Syntax: $0 <server version> [<additional parameters for wesnothd>]"
echo "Syntax: $0 <server version> [<additional parameters for wesnothd>]" >&2
exit 1
fi
@ -11,7 +11,7 @@ SERVERBASE=$HOME/servers/$SERVER
SOURCE=$HOME/source/trunk
if ! [ -d "$SERVERBASE" ]; then
echo "Server '$SERVER' not found."
echo "Server '$SERVER' not found." >&2
exit 1
fi
[ -d "$SERVERBASE/logs" ] || mkdir $SERVERBASE/logs
@ -30,7 +30,6 @@ case $SERVER in
;;
* )
esac
OPTIONS="-c $SERVERBASE/wesnothd.cfg --port $PORT --threads $THREADS $PARAMETERS"
ulimit -Ss 2048
ulimit -c unlimited
@ -43,18 +42,20 @@ do
if ps -C wesnothd-$SERVER >/dev/null; then
sleep 10
else
DATE=$(date +"%Y%m%d-%H%M%S")
BUILDDIR=$(ls -l $SERVERBASE/build | sed -e 's,.*\(\.\./builds/wesnothd-.*/\),\1,')
REV=$(ls -l $SERVERBASE/build | sed -e 's,.*wesnothd-\(svn-.*\)_.*/,\1,')
LOG=wesnothd.$DATE.$REV.log
cd $SERVERBASE/build || exit 1
if ! [ -x bin/wesnothd-$SERVER ]; then
echo "Executable 'bin/wesnothd-$SERVER' not found."
echo "Executable 'bin/wesnothd-$SERVER' not found." >&2
exit 1
fi
nice -n 3 bin/wesnothd-$SERVER $OPTIONS > $SERVERBASE/logs/$LOG 2>&1 &
DATE=$(date +"%Y%m%d-%H%M%S")
PORT=$(sed -re '/port=/!d;s/[ \t]*port="?([0-9]+)"?/\1/' $SERVERBASE/redirect.cfg)
BUILDDIR=$(ls -l $SERVERBASE/build | cut -d ' ' -f 12)
REV=r$(echo "$BUILDDIR" | sed -re "s,.*wesnothd-svn-([0-9:SM]+)_$SERVER/$,\1,")
LOG=wesnothd.$DATE.$REV.log
COMMAND="bin/wesnothd-$SERVER -c $SERVERBASE/wesnothd.cfg --port $PORT --threads $THREADS $PARAMETERS"
nice -n 3 $COMMAND > $SERVERBASE/logs/$LOG 2>&1 &
PID=$!
echo -n "started $SERVER server (revision: $REV, pid: $PID) at: "; date
echo "started $SERVER server with command: '$COMMAND' (revision: $REV, pid: $PID) at: $DATE"
ln -s ../../$SERVER/logs/$LOG $LOG.$PID
rm -f $SERVERBASE/old.log
mv $SERVERBASE/current.log $SERVERBASE/old.log > /dev/null 2>&1

View file

@ -1,6 +1,6 @@
#!/bin/sh
if ! [ $# -ge 2 ]; then
echo "Syntax: $0 <server version> <command [arguments]>"
echo "Syntax: $0 <server version> <command [arguments]>" >&2
exit 1
fi
@ -8,15 +8,16 @@ SERVER=$1
SERVERBASE=$HOME/servers/$SERVER
SOCKET=$SERVERBASE/build/var/run/socket
if ! [ -d "$SERVERBASE" ]; then
echo "Server '$SERVER' not found."
echo "Server '$SERVER' not found." >&2
exit 1
fi
if ! [ -e $SOCKET ]; then
echo "$SOCKET not found, using the 'oldbuild'."
echo "$SOCKET not found, using the 'oldbuild'." >&2
SOCKET=$SERVERBASE/oldbuild/var/run/socket
fi
if ! [ -p $SOCKET ]; then
echo "$SOCKET is not a named pipe (fifo)"
echo "$SOCKET is not a named pipe (fifo)." >&2
echo "Is the $SERVER server running?" >&2
exit 1
fi

View file

@ -1,6 +1,6 @@
#!/bin/sh
if ! [ $# -ge 1 ]; then
echo "Syntax: $0 <server version> [message]"
echo "Syntax: $0 <server version> [message]" >&2
exit 1
fi
@ -8,7 +8,7 @@ SERVER=$1
SERVERBASE=$HOME/servers/$SERVER
SOCKET=$SERVERBASE/build/var/run/socket
if ! [ -d "$SERVERBASE" ]; then
echo "Server '$SERVER' not found."
echo "Server '$SERVER' not found." >&2
exit 1
fi
shift
@ -20,11 +20,12 @@ else
fi
if ! [ -e $SOCKET ]; then
echo "$SOCKET not found, sending to the 'oldbuild'."
echo "$SOCKET not found, sending to the 'oldbuild'." >&2
SOCKET=$SERVERBASE/oldbuild/var/run/socket
fi
if ! [ -p $SOCKET ]; then
echo "$SOCKET is not a named pipe (fifo)"
echo "$SOCKET is not a named pipe (fifo)." >&2
echo "Is the $SERVER server running?" >&2
exit 1
fi

View file

@ -1,7 +1,7 @@
#!/bin/sh
if [ $# -gt 2 -o $# -lt 1 ]; then
echo "Syntax: $0 <server version> [<revision>]"
echo "Syntax: $0 <server version> [<revision>]" >&2
exit 1
fi
@ -11,12 +11,12 @@ SOURCE=$HOME/source
SOCKET=$SERVERBASE/build/var/run/socket
if ! [ -d $SERVERBASE ]; then
echo "$SERVER server not found."
echo "$SERVER server not found." >&2
exit 1
fi
if ! [ -d $SOURCE ]; then
echo "$SOURCE not found."
echo "$SOURCE not found." >&2
exit 1
fi
# only really needed on server.wesnoth.org
@ -28,7 +28,7 @@ case $SERVER in
;;
1.4 ) cd $SOURCE/1.4 || exit 1
CXXFLAGS="$CXXFLAGS -ggdb3 -DNUM_SHARDS=7"
#SCONS=yes
SCONS=yes
;;
* ) cd $SOURCE/trunk || exit 1
CXXFLAGS="$CXXFLAGS -ggdb3 -DNUM_SHARDS=7 -O0"
@ -42,10 +42,10 @@ if [ "$2" != "" ]; then
fi
echo -n 'svn update... '
svn up $REVISION > /dev/null
rev=$(svnversion -n src/)
rev=$(svnversion -cn src/ | cut -d: -f2)
echo "to $rev"
if [ "$rev" = "" ]; then
echo "No revision information found."
echo "No revision information found." >&2
exit 1
fi
# reminder for local changes