Fixed global start and stop commands from failing.

Added lazy loading of necessary server properties.
This commit is contained in:
Marcus Whybrow
2012-07-24 22:15:24 +01:00
parent 44bab2fcec
commit 00b39ec017

View File

@ -1622,7 +1622,7 @@ server_dirty_properties() {
# Stops all running servers after a servers specified delay # Stops all running servers after a servers specified delay
# $1: String containing "stop" or "restart". Represents whether the stop is # $1: String containing "stop" or "restart". Represents whether the stop is
# with a mind to stop the server, or just to restart it. And effects # with a mind to stop the server, or just to restart it. And affects
# the message issued to players on a server. # the message issued to players on a server.
manager_stop_all_servers() { manager_stop_all_servers() {
# An array of true/false for each server # An array of true/false for each server
@ -1638,6 +1638,11 @@ manager_stop_all_servers() {
any_running="true" any_running="true"
was_running[$server]="true" was_running[$server]="true"
STOP_COUNTDOWN[$server]="true" STOP_COUNTDOWN[$server]="true"
server_property "$server" STOP_DELAY
server_property "$server" MESSAGE_STOP
server_property "$server" MESSAGE_RESTART
if [[ "${SERVER_STOP_DELAY[$server]}" -gt "$max_countdown" ]]; then if [[ "${SERVER_STOP_DELAY[$server]}" -gt "$max_countdown" ]]; then
max_countdown="${SERVER_STOP_DELAY[$server]}" max_countdown="${SERVER_STOP_DELAY[$server]}"
fi fi
@ -1680,8 +1685,8 @@ manager_stop_all_servers() {
echo -n "in $tick seconds." echo -n "in $tick seconds."
fi fi
# Each second check all server, to see if its their time to # Each second check all servers, to see if it's their time to
# stop. If so issue the stop command, and don't hang. # stop. If so issue the stop command, and don't wait.
for ((server=0; server<${NUM_SERVERS}; server++)); do for ((server=0; server<${NUM_SERVERS}; server++)); do
if server_is_running "$server"; then if server_is_running "$server"; then
stop_tick="$(( ${max_countdown} - ${SERVER_STOP_DELAY[$server]} ))" stop_tick="$(( ${max_countdown} - ${SERVER_STOP_DELAY[$server]} ))"
@ -1797,6 +1802,9 @@ manager_dirty_all() {
command_start() { command_start() {
# Required start option, for debian init.d scripts # Required start option, for debian init.d scripts
for ((server=0; server<${NUM_SERVERS}; server++)); do for ((server=0; server<${NUM_SERVERS}; server++)); do
server_property "$server" ACTIVE
# Only starts active servers # Only starts active servers
if "${SERVER_ACTIVE[$server]}"; then if "${SERVER_ACTIVE[$server]}"; then
if server_is_running "$server"; then if server_is_running "$server"; then