mirror of
https://github.com/GameServerManagers/LinuxGSM.git
synced 2025-01-07 03:26:50 +08:00
restart and monitor
This commit is contained in:
parent
c0ba7219fd
commit
227647c0cc
@ -110,12 +110,28 @@ fn_monitor_check_stopping() {
|
||||
}
|
||||
|
||||
fn_monitor_check_restart_request() {
|
||||
if [ -f "${lockdir}/${selfname}-stop-request.lock" ]; then
|
||||
if [ -f "${lockdir}/${selfname}-restart-request.lock" ]; then
|
||||
fn_print_dots "Checking restart: "
|
||||
fn_print_checking_eol
|
||||
fn_print_info "Checking restart: Restart requested: "
|
||||
fn_print_info_eol_nl
|
||||
fn_script_log_info "Checking restart: Restart requested"
|
||||
if [ "${stoponlyifnoplayers}" == "on" ]; then
|
||||
if [ "${querymode}" == "2" ] || [ "${querymode}" == "3" ]; then
|
||||
for queryip in "${queryips[@]}"; do
|
||||
query_gamedig.sh
|
||||
if [ "${querystatus}" == "0" ]; then
|
||||
if [ -n "${gdplayers}" ] && [ "${gdplayers}" -ne 0 ]; then
|
||||
fn_print_info_nl "${gdplayers} players are on the server: restart postponed"
|
||||
fn_script_log_info "${gdplayers} players are on the server: restart postponed"
|
||||
echo "${gdplayers}" > "${lockdir:?}/${selfname}-player-numbers.lock"
|
||||
date '+%s' > "${lockdir:?}/${selfname}-restart-request.lock"
|
||||
core_exit.sh
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
command_restart.sh
|
||||
core_exit.sh
|
||||
fi
|
||||
|
@ -11,6 +11,22 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||
fn_firstcommand_set
|
||||
|
||||
info_game.sh
|
||||
if [ "${stoponlyifnoplayers}" == "on" ]; then
|
||||
if [ "${querymode}" == "2" ] || [ "${querymode}" == "3" ]; then
|
||||
for queryip in "${queryips[@]}"; do
|
||||
query_gamedig.sh
|
||||
if [ "${querystatus}" == "0" ]; then
|
||||
if [ -n "${gdplayers}" ] && [ "${gdplayers}" -ne 0 ]; then
|
||||
fn_print_info_nl "${gdplayers} players are on the server: restart postponed"
|
||||
fn_script_log_info "${gdplayers} players are on the server: restart postponed"
|
||||
echo "${gdplayers}" > "${lockdir:?}/${selfname}-player-numbers.lock"
|
||||
date '+%s' > "${lockdir:?}/${selfname}-restart-request.lock"
|
||||
core_exit.sh
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
exitbypass=1
|
||||
command_stop.sh
|
||||
command_start.sh
|
||||
|
@ -18,15 +18,10 @@ fn_stop_players_online() {
|
||||
query_gamedig.sh
|
||||
if [ "${querystatus}" == "0" ]; then
|
||||
if [ -n "${gdplayers}" ] && [ "${gdplayers}" -ne 0 ]; then
|
||||
fn_print_info_nl "Server will not stop while ${gdplayers} players are on the server"
|
||||
fn_script_log_info "Server will not stop while ${gdplayers} players are on the server"
|
||||
date '+%s' > "${lockdir:?}/${selfname}-stop-request.lock"
|
||||
fn_print_info_nl "${gdplayers} players are on the server: stop prevented"
|
||||
fn_script_log_info "${gdplayers} players are on the server: stop prevented"
|
||||
echo "${gdplayers}" > "${lockdir:?}/${selfname}-player-numbers.lock"
|
||||
core_exit.sh
|
||||
else
|
||||
if [ -f "${lockdir:?}/${selfname}-stop-request.lock" ]; then
|
||||
rm -f "${lockdir:?}/${selfname}-stop-request.lock"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user