mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-17 11:28:16 +00:00
removed some bashisms
This commit is contained in:
parent
f182438a2f
commit
7c61088e82
@ -41,10 +41,10 @@ do
|
|||||||
COMMAND="$HOME/bin/campaignd-$VERSION $THREADS $PARAMETERS"
|
COMMAND="$HOME/bin/campaignd-$VERSION $THREADS $PARAMETERS"
|
||||||
LOG="$SERVERBASE/logs/campaignd.$DATE.log"
|
LOG="$SERVERBASE/logs/campaignd.$DATE.log"
|
||||||
echo "started $VERSION campaignd with command: '$COMMAND' logging to: $LOG"
|
echo "started $VERSION campaignd with command: '$COMMAND' logging to: $LOG"
|
||||||
$COMMAND &> $LOG
|
$COMMAND > $LOG 2>&1
|
||||||
EXIT_CODE="$?"
|
EXIT_CODE="$?"
|
||||||
echo "exit code: $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
|
case $EXIT_CODE in
|
||||||
0) exit ;;
|
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
|
1|2|3|127) dietail ;; #"File I/O error." #"Could not parse config file." #"Could not bind to port." #cannot open shared object file
|
||||||
|
@ -70,14 +70,14 @@ do
|
|||||||
BUILDDIR=$(ls -ld "$SERVERBASE"/build | sed -nre 's,.*(\.\./builds/wesnothd-[^ ]+/),\1,p')
|
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")
|
REV=r$(echo $BUILDDIR | sed -nre "s,.*wesnothd-svn-([0-9:SM]+)_$SERVER/$,\1,p")
|
||||||
LOG="wesnothd.$DATE.$REV.log"
|
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=$!
|
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"
|
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
|
# create some convenient links
|
||||||
ln -s "$SERVERBASE/logs/$LOG" "$LOG.$PID"
|
ln -s "$SERVERBASE/logs/$LOG" "$LOG.$PID"
|
||||||
rm -f "$SERVERBASE"/old.{log,pid}
|
rm -f "$SERVERBASE"/old.log "$SERVERBASE"/old.pid
|
||||||
mv "$SERVERBASE"/current.log "$SERVERBASE"/old.log &> /dev/null
|
mv "$SERVERBASE"/current.log "$SERVERBASE"/old.log > /dev/null 2>&1
|
||||||
mv "$SERVERBASE"/current.pid "$SERVERBASE"/old.pid &> /dev/null
|
mv "$SERVERBASE"/current.pid "$SERVERBASE"/old.pid > /dev/null 2>&1
|
||||||
echo $PID > "$SERVERBASE"/current.pid
|
echo $PID > "$SERVERBASE"/current.pid
|
||||||
ln -s "logs/$LOG" "$SERVERBASE"/current.log
|
ln -s "logs/$LOG" "$SERVERBASE"/current.log
|
||||||
# wait for the server to terminate
|
# wait for the server to terminate
|
||||||
@ -86,7 +86,7 @@ do
|
|||||||
EXIT_CODE=$?
|
EXIT_CODE=$?
|
||||||
echo "wesnothd exited with code: $EXIT_CODE"
|
echo "wesnothd exited with code: $EXIT_CODE"
|
||||||
# need to use the recorded path since the build/ symlink might have changed
|
# 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
|
# check for return code if not zero or 98 (port in use) the server should be restarted
|
||||||
case $EXIT_CODE in
|
case $EXIT_CODE in
|
||||||
0) exit ;;
|
0) exit ;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user