Files
mtgodot-poc/tools/40250/stop_server.sh
T

22 lines
398 B
Bash
Executable File

#!/bin/sh
set -eu
server_root=${MT40250_ROOT:-/usr/metin2}
pid_file="$server_root/.mt40250-pids"
if [ ! -f "$pid_file" ]; then
echo "stop_server.sh: no $pid_file"
exit 0
fi
while read -r pid name; do
case "$pid" in
''|*[!0-9]*) continue ;;
esac
if kill -0 "$pid" 2>/dev/null; then
kill "$pid" 2>/dev/null || true
echo "stopped $name pid=$pid"
fi
done < "$pid_file"
rm -f "$pid_file"