Browse Source

feat(monitor): Include bot count in monitor output

Update to include bot count in monitor output from Gamedig.
pull/2821/head
Jimmy Maple 5 years ago
committed by GitHub
parent
commit
4b16cb26c5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      lgsm/functions/command_monitor.sh

14
lgsm/functions/command_monitor.sh

@ -12,7 +12,7 @@ local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
fn_monitor_check_lockfile(){ fn_monitor_check_lockfile(){
# Monitor does not run it lockfile is not found. # Monitor does not run it lockfile is not found.
if [ ! -f "${lockdir}/${selfname}.lock" ]; then if [ ! -f "${rootdir}/${lockselfname}" ]; then
fn_print_dots "Checking lockfile: " fn_print_dots "Checking lockfile: "
fn_print_checking_eol fn_print_checking_eol
fn_script_log_info "Checking lockfile: CHECKING" fn_script_log_info "Checking lockfile: CHECKING"
@ -21,13 +21,13 @@ fn_monitor_check_lockfile(){
fn_print_error_eol_nl fn_print_error_eol_nl
fn_script_log_error "Checking lockfile: No lockfile found: ERROR" fn_script_log_error "Checking lockfile: No lockfile found: ERROR"
fn_sleep_time fn_sleep_time
echo -en "* Start ${selfname} to run monitor." echo -e "* Start ${selfname} to run monitor."
core_exit.sh core_exit.sh
fi fi
# Fix if lockfile is not unix time or contains letters # Fix if lockfile is not unix time or contains letters
if [[ "$(cat "${lockdir}/${selfname}.lock")" =~ [A-Za-z] ]]; then if [[ "$(cat "${rootdir}/${lockselfname}")" =~ [A-Za-z] ]]; then
date '+%s' > "${lockdir}/${selfname}.lock" date '+%s' > "${rootdir}/${lockselfname}"
fi fi
} }
@ -108,7 +108,7 @@ for queryattempt in {1..5}; do
fn_script_log_info "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt} : QUERYING" fn_script_log_info "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt} : QUERYING"
fn_sleep_time fn_sleep_time
# querydelay # querydelay
if [ "$(cat "${lockdir}/${selfname}.lock")" -gt "$(date "+%s" -d "${querydelay} mins ago")" ]; then if [ "$(cat "${rootdir}/${lockselfname}")" -gt "$(date "+%s" -d "${querydelay} mins ago")" ]; then
fn_print_ok "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: " fn_print_ok "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: "
fn_print_delay_eol_nl fn_print_delay_eol_nl
fn_script_log_info "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt} : DELAY" fn_script_log_info "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt} : DELAY"
@ -147,6 +147,9 @@ for queryattempt in {1..5}; do
if [ "${gdplayers}" ]; then if [ "${gdplayers}" ]; then
fn_script_log_info "Players: ${gdplayers}/${gdmaxplayers}" fn_script_log_info "Players: ${gdplayers}/${gdmaxplayers}"
fi fi
if [ "${gdbots}" ]; then
fn_script_log_info "Bots: ${gdbots}"
fi
if [ "${gdmap}" ]; then if [ "${gdmap}" ]; then
fn_script_log_info "Map: ${gdmap}" fn_script_log_info "Map: ${gdmap}"
fi fi
@ -236,7 +239,6 @@ info_parms.sh
# query pre-checks # query pre-checks
fn_monitor_check_lockfile fn_monitor_check_lockfile
check_last_update.sh
fn_monitor_check_update fn_monitor_check_update
fn_monitor_check_session fn_monitor_check_session
# Monitor will not continue if session only check. # Monitor will not continue if session only check.

Loading…
Cancel
Save