removed some bashisms

This commit is contained in:
Gunter Labes 2009-05-23 13:26:18 +00:00
parent f182438a2f
commit 7c61088e82
2 changed files with 7 additions and 7 deletions

View file

@ -41,10 +41,10 @@ do
COMMAND="$HOME/bin/campaignd-$VERSION $THREADS $PARAMETERS"
LOG="$SERVERBASE/logs/campaignd.$DATE.log"
echo "started $VERSION campaignd with command: '$COMMAND' logging to: $LOG"
$COMMAND &> $LOG
$COMMAND > $LOG 2>&1
EXIT_CODE="$?"
echo "exit code: $EXIT_CODE"
mv gmon.out gmon.$DATE.out &> /dev/null
mv gmon.out gmon.$DATE.out > /dev/null 2>&1
case $EXIT_CODE in
0) exit ;;
1|2|3|127) dietail ;; #"File I/O error." #"Could not parse config file." #"Could not bind to port." #cannot open shared object file

View file

@ -70,14 +70,14 @@ do
BUILDDIR=$(ls -ld "$SERVERBASE"/build | sed -nre 's,.*(\.\./builds/wesnothd-[^ ]+/),\1,p')
REV=r$(echo $BUILDDIR | sed -nre "s,.*wesnothd-svn-([0-9:SM]+)_$SERVER/$,\1,p")
LOG="wesnothd.$DATE.$REV.log"
bin/wesnothd-$SERVER -c "$SERVERBASE"/wesnothd.cfg --port $PORT --threads $THREADS $PARAMETERS &> "$SERVERBASE/logs/$LOG" &
bin/wesnothd-$SERVER -c "$SERVERBASE"/wesnothd.cfg --port $PORT --threads $THREADS $PARAMETERS > "$SERVERBASE/logs/$LOG" 2>&1 &
PID=$!
echo "started $SERVER server with command: 'wesnothd-$SERVER -c \"$SERVERBASE\"/wesnothd.cfg --port $PORT --threads $THREADS $PARAMETERS' (revision: $REV, pid: $PID) logging to: $LOG"
# create some convenient links
ln -s "$SERVERBASE/logs/$LOG" "$LOG.$PID"
rm -f "$SERVERBASE"/old.{log,pid}
mv "$SERVERBASE"/current.log "$SERVERBASE"/old.log &> /dev/null
mv "$SERVERBASE"/current.pid "$SERVERBASE"/old.pid &> /dev/null
rm -f "$SERVERBASE"/old.log "$SERVERBASE"/old.pid
mv "$SERVERBASE"/current.log "$SERVERBASE"/old.log > /dev/null 2>&1
mv "$SERVERBASE"/current.pid "$SERVERBASE"/old.pid > /dev/null 2>&1
echo $PID > "$SERVERBASE"/current.pid
ln -s "logs/$LOG" "$SERVERBASE"/current.log
# wait for the server to terminate
@ -86,7 +86,7 @@ do
EXIT_CODE=$?
echo "wesnothd exited with code: $EXIT_CODE"
# need to use the recorded path since the build/ symlink might have changed
mv "$SERVERBASE/$BUILDDIR/gmon.out" "$SERVERBASE/$BUILDDIR/gmon.$DATE.$REV.out" &> /dev/null
mv "$SERVERBASE/$BUILDDIR/gmon.out" "$SERVERBASE/$BUILDDIR/gmon.$DATE.$REV.out" > /dev/null 2>&1
# check for return code if not zero or 98 (port in use) the server should be restarted
case $EXIT_CODE in
0) exit ;;