mirror of
https://github.com/MinecraftServerControl/mscs.git
synced 2024-11-15 06:48:16 -07:00
Merge pull request #233 from sheimer/master
query server restarts if shut down
This commit is contained in:
commit
c2a603d32b
4
msctl
4
msctl
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user