mirror of
https://github.com/eliasstepanik/ark-ac-server-tools.git
synced 2026-01-25 15:58:27 +00:00
Fix getMultiHome
This commit is contained in:
parent
d5a14c74a8
commit
6da2c49f6d
@ -375,6 +375,10 @@ getRconPort() {
|
|||||||
# Gets server bind IP
|
# Gets server bind IP
|
||||||
#
|
#
|
||||||
getMultiHome() {
|
getMultiHome() {
|
||||||
|
getArkServerSetting "MultiHome" "${1}"
|
||||||
|
}
|
||||||
|
|
||||||
|
getMultiHomeIP() {
|
||||||
getArkServerSetting "MultiHome" "${1:-127.0.0.1}"
|
getArkServerSetting "MultiHome" "${1:-127.0.0.1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,7 +449,7 @@ rconcmd() {
|
|||||||
} else {
|
} else {
|
||||||
print "\"", $rcvbody, "\"\n";
|
print "\"", $rcvbody, "\"\n";
|
||||||
}
|
}
|
||||||
' "$(getRconPort)" "$(getMultiHome)" "$adminpass" "$1"
|
' "$(getRconPort)" "$(getMultiHomeIP)" "$adminpass" "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -780,7 +784,7 @@ function isTheServerRunning(){
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
function isTheServerUp(){
|
function isTheServerUp(){
|
||||||
local ip="$(getMultiHome "")"
|
local ip="$(getMultiHome)"
|
||||||
result=1
|
result=1
|
||||||
if [ ! -x "$lsof" ]; then
|
if [ ! -x "$lsof" ]; then
|
||||||
"$lsof" -i "${ip:+udp@}${ip}:$(getGamePort)" > /dev/null
|
"$lsof" -i "${ip:+udp@}${ip}:$(getGamePort)" > /dev/null
|
||||||
@ -807,7 +811,7 @@ function isTheServerUp(){
|
|||||||
} else {
|
} else {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
' "$(getQueryPort)" "$(getMultiHome)"
|
' "$(getQueryPort)" "$(getMultiHomeIP)"
|
||||||
result=$?
|
result=$?
|
||||||
fi
|
fi
|
||||||
# In this case, the result is:
|
# In this case, the result is:
|
||||||
@ -824,8 +828,8 @@ function isTheServerUp(){
|
|||||||
# Check if the server is visible in the steam server list
|
# Check if the server is visible in the steam server list
|
||||||
#
|
#
|
||||||
function isTheServerOnline(){
|
function isTheServerOnline(){
|
||||||
if [ -n "$(getMultiHome "")" ]; then
|
if [ -n "$(getMultiHome)" ]; then
|
||||||
publicip="$(curl --interface "$(getMultiHome)" -s http://api.ipify.org/)"
|
publicip="$(curl --interface "$(getMultiHomeIP)" -s http://api.ipify.org/)"
|
||||||
else
|
else
|
||||||
publicip="$(curl -s http://api.ipify.org/)"
|
publicip="$(curl -s http://api.ipify.org/)"
|
||||||
fi
|
fi
|
||||||
@ -876,7 +880,7 @@ function numPlayersConnected(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
print "$active\n";
|
print "$active\n";
|
||||||
' "$(getQueryPort)" "$(getMultiHome)"
|
' "$(getQueryPort)" "$(getMultiHomeIP)"
|
||||||
else
|
else
|
||||||
perl -MSocket -e '
|
perl -MSocket -e '
|
||||||
my $port = int($ARGV[0]);
|
my $port = int($ARGV[0]);
|
||||||
@ -889,7 +893,7 @@ function numPlayersConnected(){
|
|||||||
my ($servername, $mapname, $game, $fullname, $rest) = split(/\x00/, substr($data, 6), 5);
|
my ($servername, $mapname, $game, $fullname, $rest) = split(/\x00/, substr($data, 6), 5);
|
||||||
my $players = ord(substr($rest, 2, 1));
|
my $players = ord(substr($rest, 2, 1));
|
||||||
print "$players\n";
|
print "$players\n";
|
||||||
' "$(getQueryPort)" "$(getMultiHome)"
|
' "$(getQueryPort)" "$(getMultiHomeIP)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2871,7 +2875,7 @@ printStatus(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
print "Active Players: $active\n";
|
print "Active Players: $active\n";
|
||||||
' "$(getQueryPort)" "$(getMultiHome)"
|
' "$(getQueryPort)" "$(getMultiHomeIP)"
|
||||||
|
|
||||||
if isTheServerOnline; then
|
if isTheServerOnline; then
|
||||||
echo -e "$NORMAL" "Server online: " "$GREEN" "Yes" "$NORMAL"
|
echo -e "$NORMAL" "Server online: " "$GREEN" "Yes" "$NORMAL"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user