Skip to content

Commit

Permalink
Merge pull request MinecraftServerControl#233 from sheimer/master
Browse files Browse the repository at this point in the history
query server restarts if shut down
  • Loading branch information
sandain committed Jan 16, 2020
2 parents 2bf4d41 + 5190994 commit c2a603d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion msctl
Expand Up @@ -1753,7 +1753,7 @@ queryStart() {
# server is piped into the query.out file. Give the server a moment to
# start before initializing the Query handler.
nohup sh -c "
sleep 20;
sleep 1;
tail -f --pid=$SERVER_PID \"$WORLD_DIR/query.in\" |
$SOCAT - UDP:$SERVER_IP:$QUERY_PORT > \"$WORLD_DIR/query.out\"
" >/dev/null 2>&1 &
Expand Down Expand Up @@ -1811,6 +1811,8 @@ querySendPacket() {
$packed = join "", map { pack ("C", hex($_)) } ("'$RESPONSE'" =~ /(..)/g);
printf "%s\n", join "\t", unpack ("'$4'", $packed);
'
else
ps a | grep socat | grep "$1" | grep tail >/dev/null || queryStart "$1"
fi
}

Expand Down

0 comments on commit c2a603d

Please sign in to comment.