#!/bin/sh # Stops the sbtest cluster and puts channel5 back on the live db with the binary it had before setup.sh # (README.md). The *_sb schemas and /usr/metin2/server/sbtest stay; setup.sh rebuilds them. set -eu R=/usr/metin2/server T=$R/sbtest C5=$R/channel5/first [ -f $C5/CONFIG.livedb ] || { echo "no $C5/CONFIG.livedb; channel5 was never moved" >&2; exit 1; } for d in $C5 $T/auth $T/db; do [ -f $d/pid ] || continue p=$(cat $d/pid) kill -0 "$p" 2>/dev/null || continue kill -1 "$p" i=0; while kill -0 "$p" 2>/dev/null && [ $i -lt 40 ]; do sleep 1; i=$((i+1)); done echo "$d stopped after ${i}s" done cp $C5/CONFIG.livedb $C5/CONFIG [ -e $C5/game.livedb ] && { rm -f $C5/game; mv $C5/game.livedb $C5/game; } daemon -f sh -c "cd $C5 && exec ./game > stdout 2>&1"; sleep 12 grep -E '^DB_PORT' $C5/CONFIG; ls -l $C5/game sockstat -l | grep -E ':(13040) '