Implement 40250 classic client port
This commit is contained in:
Executable
+53
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
server_root=${MT40250_ROOT:-/usr/metin2}
|
||||
runtime="$server_root/server"
|
||||
pid_file="$server_root/.mt40250-pids"
|
||||
if [ "$(uname -s)" != "FreeBSD" ]; then
|
||||
echo "start_server.sh: 40250 runtime is FreeBSD-only" >&2
|
||||
exit 2
|
||||
fi
|
||||
if [ ! -x "$runtime/db/db" ] || [ ! -x "$runtime/auth/auth" ]; then
|
||||
echo "start_server.sh: run prepare_runtime.sh first" >&2
|
||||
exit 2
|
||||
fi
|
||||
if [ -f "$pid_file" ]; then
|
||||
echo "start_server.sh: $pid_file exists; stop the existing server first" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
launch() {
|
||||
name=$1
|
||||
dir=$2
|
||||
bin=$3
|
||||
if [ ! -x "$dir/$bin" ]; then
|
||||
echo "start_server.sh: missing $dir/$bin" >&2
|
||||
exit 2
|
||||
fi
|
||||
(
|
||||
cd "$dir"
|
||||
exec "./$bin"
|
||||
) >> "$dir/console.log" 2>&1 &
|
||||
pid=$!
|
||||
echo "$pid $name" >> "$pid_file"
|
||||
echo "started $name pid=$pid"
|
||||
}
|
||||
|
||||
: > "$pid_file"
|
||||
launch db "$runtime/db" db
|
||||
sleep "${MT40250_DB_WAIT_SECONDS:-2}"
|
||||
launch auth "$runtime/auth" auth
|
||||
|
||||
channels=${MT40250_CHANNELS:-"1 2 3 4"}
|
||||
for channel in $channels; do
|
||||
for node in first game1 game2; do
|
||||
launch "channel${channel}/${node}" "$runtime/channel${channel}/${node}" game
|
||||
done
|
||||
done
|
||||
|
||||
if [ "${MT40250_START_GAME99:-1}" = "1" ]; then
|
||||
launch game99 "$runtime/game99" game
|
||||
fi
|
||||
|
||||
echo "40250 server started; logs are under $runtime/*/console.log"
|
||||
Reference in New Issue
Block a user