Merge pull request #233 from sheimer/master

query server restarts if shut down
This commit is contained in:
Jason M. Wood 2020-01-16 10:58:40 -08:00 committed by GitHub
commit c2a603d32b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

4
msctl
View File

@ -1753,7 +1753,7 @@ queryStart() {
# server is piped into the query.out file. Give the server a moment to # server is piped into the query.out file. Give the server a moment to
# start before initializing the Query handler. # start before initializing the Query handler.
nohup sh -c " nohup sh -c "
sleep 20; sleep 1;
tail -f --pid=$SERVER_PID \"$WORLD_DIR/query.in\" | tail -f --pid=$SERVER_PID \"$WORLD_DIR/query.in\" |
$SOCAT - UDP:$SERVER_IP:$QUERY_PORT > \"$WORLD_DIR/query.out\" $SOCAT - UDP:$SERVER_IP:$QUERY_PORT > \"$WORLD_DIR/query.out\"
" >/dev/null 2>&1 & " >/dev/null 2>&1 &
@ -1811,6 +1811,8 @@ querySendPacket() {
$packed = join "", map { pack ("C", hex($_)) } ("'$RESPONSE'" =~ /(..)/g); $packed = join "", map { pack ("C", hex($_)) } ("'$RESPONSE'" =~ /(..)/g);
printf "%s\n", join "\t", unpack ("'$4'", $packed); printf "%s\n", join "\t", unpack ("'$4'", $packed);
' '
else
ps a | grep socat | grep "$1" | grep tail >/dev/null || queryStart "$1"
fi fi
} }