3 # Abort the script on error.
6 # Use the shell script's arguments to the server's arguments.
7 ./roguelike-server "$@" &
9 # Give server some time to start up and exit on error.
12 # The client should not start if the server is not running. (If the server was
13 # running in the foreground, any error exit of it so far would be caught by "set
14 # -e" above. But "set -e" is blind to error codes generated in the background.)
15 kill -0 $! 2> /dev/null
17 # Give server some time (max. 10 seconds) to generate its worldstate file.
19 while [ ! -e server/worldstate ] && [ $i -le 1000 ]
24 if [ ! -e server/worldstate ]
26 echo "Server failed generating worldstate file within given time limit."
30 # Only start the interface when everything else went well.
31 kill -0 $! 2> /dev/null