mirror of
https://gitlab.com/2009scape/singleplayer/windows.git
synced 2026-08-01 14:39:18 -06:00
improve launch script to actually wait for the server
This commit is contained in:
parent
d20454392b
commit
318665a335
1 changed files with 20 additions and 8 deletions
28
launch.sh
28
launch.sh
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
export _JAVA_OPTIONS=
|
||||
SCRIPT_DIR=$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)
|
||||
FIRST_RUN=1
|
||||
|
||||
lsof -i:43595
|
||||
|
||||
|
|
@ -10,21 +11,32 @@ if [ $? -ne 1 ]; then
|
|||
exit
|
||||
fi
|
||||
|
||||
if [ -f "$SCRIPT_DIR/game/data/eco/grandexchange.db" ]; then
|
||||
FIRST_RUN=0
|
||||
else
|
||||
echo "This is first run of the single-player release in this location."
|
||||
echo "Please allow some time (30-60s) for initial data structure creation before asking for support."
|
||||
|
||||
sleep 3
|
||||
fi
|
||||
|
||||
cd $SCRIPT_DIR/game
|
||||
java -jar -Xmx2G -Xms2G -jar server.jar &
|
||||
SERVER_PID=$!
|
||||
|
||||
lsof -i:43595
|
||||
while [ $? -eq 1 ]; do
|
||||
lsof -i:43595
|
||||
echo "Still waiting for the server to start..."
|
||||
sleep 2
|
||||
lsof -i:43595 > /dev/null
|
||||
while [ $? -eq "1" ]; do
|
||||
if [ $FIRST_RUN -ne "1" ]; then
|
||||
echo "Still waiting for the server to start..."
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
lsof -i:43595 > /dev/null
|
||||
done;
|
||||
|
||||
java -Xmx1G -Xms1G -jar client.jar &
|
||||
CLIENT_PID=$!
|
||||
sleep 2
|
||||
java -Xmx1G -Xms1G -jar client.jar
|
||||
|
||||
wait $CLIENT_PID
|
||||
kill $SERVER_PID
|
||||
exit
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue