|
|
@@ -18,10 +18,10 @@ fn_monitor_check_monitoring() {
|
|
|
date '+%s' > "${lockdir:?}/${selfname}-monitoring.lock"
|
|
|
elif [ ! -f "${lockdir}/${selfname}-monitoring.lock" ]; then
|
|
|
# Monitor does not run if lockfile is not found.
|
|
|
- fn_print_dots "Checking lockfile: "
|
|
|
+ fn_print_dots "Checking lockfile:"
|
|
|
fn_print_checking_eol
|
|
|
fn_script_log_info "Checking lockfile: CHECKING"
|
|
|
- fn_print_error "Checking lockfile: No lockfile found: "
|
|
|
+ fn_print_error "Checking lockfile: No lockfile found:"
|
|
|
fn_print_error_eol_nl
|
|
|
fn_script_log_error "Checking lockfile: No lockfile found: ERROR"
|
|
|
echo -e "* Start ${selfname} to run monitor."
|
|
|
@@ -31,10 +31,10 @@ fn_monitor_check_monitoring() {
|
|
|
|
|
|
fn_monitor_check_install() {
|
|
|
if [ "$(pgrep -fc -u "${USER}" "/bin/bash ./${selfname} install")" != "0" ] || [ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} i")" != "0" ] || [ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} auto-install")" != "0" ] || [ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} ai")" != "0" ]; then
|
|
|
- fn_print_dots "Checking installer: "
|
|
|
+ fn_print_dots "Checking installer:"
|
|
|
fn_print_checking_eol
|
|
|
fn_script_log_info "Checking installer: CHECKING"
|
|
|
- fn_print_info "Checking installer: LinuxGSM is installing: "
|
|
|
+ fn_print_info "Checking installer: LinuxGSM is installing:"
|
|
|
fn_print_info_eol_nl
|
|
|
fn_script_log_pass "Checking installer: LinuxGSM is installing"
|
|
|
core_exit.sh
|
|
|
@@ -43,9 +43,9 @@ fn_monitor_check_install() {
|
|
|
|
|
|
fn_monitor_check_debug() {
|
|
|
if [ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} debug")" != "0" ] || [ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} d")" != "0" ]; then
|
|
|
- fn_print_dots "Checking debug: "
|
|
|
+ fn_print_dots "Checking debug:"
|
|
|
fn_print_checking_eol
|
|
|
- fn_print_info "Checking debug: Debug is running: "
|
|
|
+ fn_print_info "Checking debug: Debug is running:"
|
|
|
fn_print_info_eol_nl
|
|
|
fn_script_log_pass "Checking debug: Debug is running"
|
|
|
core_exit.sh
|
|
|
@@ -54,9 +54,9 @@ fn_monitor_check_debug() {
|
|
|
|
|
|
fn_monitor_check_details() {
|
|
|
if [ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} details")" != "0" ] || [ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} dt")" != "0" ]; then
|
|
|
- fn_print_dots "Checking details: "
|
|
|
+ fn_print_dots "Checking details:"
|
|
|
fn_print_checking_eol
|
|
|
- fn_print_info "Checking details: Details is running: "
|
|
|
+ fn_print_info "Checking details: Details is running:"
|
|
|
fn_print_info_eol_nl
|
|
|
fn_script_log_pass "Checking details: Details is running"
|
|
|
core_exit.sh
|
|
|
@@ -67,9 +67,9 @@ fn_monitor_check_starting() {
|
|
|
# Remove stale lockfile.
|
|
|
if [ -f "${lockdir}/${selfname}-starting.lock" ]; then
|
|
|
if [ "$(find "${lockdir}/${selfname}-starting.lock" -mmin +5)" ]; then
|
|
|
- fn_print_dots "Checking start: "
|
|
|
+ fn_print_dots "Checking start:"
|
|
|
fn_print_checking_eol
|
|
|
- fn_print_warn "Checking start: Removing stale lockfile: "
|
|
|
+ fn_print_warn "Checking start: Removing stale lockfile:"
|
|
|
fn_print_warn_eol_nl
|
|
|
fn_script_log_warn "Checking start: Removing stale lockfile"
|
|
|
rm -f "${lockdir:?}/${selfname}-starting.lock"
|
|
|
@@ -77,9 +77,9 @@ fn_monitor_check_starting() {
|
|
|
fi
|
|
|
|
|
|
if [ -f "${lockdir}/${selfname}-starting.lock" ] && [[ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} start")" != "0" || "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} s")" != "0" ]]; then
|
|
|
- fn_print_dots "Checking start: "
|
|
|
+ fn_print_dots "Checking start:"
|
|
|
fn_print_checking_eol
|
|
|
- fn_print_info "Checking start: LinuxGSM is starting: "
|
|
|
+ fn_print_info "Checking start: LinuxGSM is starting:"
|
|
|
fn_print_info_eol_nl
|
|
|
fn_script_log_info "Checking backup: LinuxGSM is starting"
|
|
|
core_exit.sh
|
|
|
@@ -90,9 +90,9 @@ fn_monitor_check_stopping() {
|
|
|
# Remove stale lockfile.
|
|
|
if [ -f "${lockdir}/${selfname}-stopping.lock" ]; then
|
|
|
if [ "$(find "${lockdir}/${selfname}-stopping.lock" -mmin +5)" ]; then
|
|
|
- fn_print_dots "Checking stop: "
|
|
|
+ fn_print_dots "Checking stop:"
|
|
|
fn_print_checking_eol
|
|
|
- fn_print_warn "Checking stop: Removing stale lockfile: "
|
|
|
+ fn_print_warn "Checking stop: Removing stale lockfile:"
|
|
|
fn_print_warn_eol_nl
|
|
|
fn_script_log_warn "Checking stop: Removing stale lockfile"
|
|
|
rm -f "${lockdir:?}/${selfname}-stopping.lock"
|
|
|
@@ -100,9 +100,9 @@ fn_monitor_check_stopping() {
|
|
|
fi
|
|
|
|
|
|
if [ -f "${lockdir}/${selfname}-stopping.lock" ] && [[ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} stop")" != "0" || "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} s")" != "0" ]]; then
|
|
|
- fn_print_dots "Checking stop: "
|
|
|
+ fn_print_dots "Checking stop:"
|
|
|
fn_print_checking_eol
|
|
|
- fn_print_info "Checking stop: LinuxGSM is stopping: "
|
|
|
+ fn_print_info "Checking stop: LinuxGSM is stopping:"
|
|
|
fn_print_info_eol_nl
|
|
|
fn_script_log_info "Checking backup: LinuxGSM is stopping"
|
|
|
core_exit.sh
|
|
|
@@ -113,9 +113,9 @@ fn_monitor_check_backup() {
|
|
|
# Remove stale lockfile.
|
|
|
if [ -f "${lockdir}/backup.lock" ]; then
|
|
|
if [ "$(find "${lockdir}/backup.lock" -mmin +60)" ]; then
|
|
|
- fn_print_dots "Checking backup: "
|
|
|
+ fn_print_dots "Checking backup:"
|
|
|
fn_print_checking_eol
|
|
|
- fn_print_warn "Checking backup: Removing stale lockfile: "
|
|
|
+ fn_print_warn "Checking backup: Removing stale lockfile:"
|
|
|
fn_print_warn_eol
|
|
|
fn_script_log_warn "Checking backup: Removing stale lockfile"
|
|
|
rm -f "${lockdir:?}/backup.lock"
|
|
|
@@ -123,9 +123,9 @@ fn_monitor_check_backup() {
|
|
|
fi
|
|
|
|
|
|
if [ -f "${lockdir}/backup.lock" ] && [[ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} backup")" != "0" || "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} b")" != "0" ]]; then
|
|
|
- fn_print_dots "Checking backup: "
|
|
|
+ fn_print_dots "Checking backup:"
|
|
|
fn_print_checking_eol
|
|
|
- fn_print_info "Checking backup: Backup is running: "
|
|
|
+ fn_print_info "Checking backup: Backup is running:"
|
|
|
fn_print_info_eol_nl
|
|
|
fn_script_log_info "Checking backup: Backup is running"
|
|
|
core_exit.sh
|
|
|
@@ -136,9 +136,9 @@ fn_monitor_check_update() {
|
|
|
# Remove stale lockfile.
|
|
|
if [ -f "${lockdir}/update.lock" ]; then
|
|
|
if [ "$(find "${lockdir}/update.lock" -mmin +15)" ]; then
|
|
|
- fn_print_dots "Checking update: "
|
|
|
+ fn_print_dots "Checking update:"
|
|
|
fn_print_checking_eol
|
|
|
- fn_print_warn "Checking update: Removing stale lockfile: "
|
|
|
+ fn_print_warn "Checking update: Removing stale lockfile:"
|
|
|
fn_print_warn_eol_nl
|
|
|
fn_script_log_warn "Checking update: Removing stale lockfile"
|
|
|
rm -f "${lockdir:?}/update.lock"
|
|
|
@@ -146,9 +146,9 @@ fn_monitor_check_update() {
|
|
|
fi
|
|
|
|
|
|
if [ -f "${lockdir}/update.lock" ] && [[ "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} update")" != "0" || "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} validate")" != "0" || "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} v")" != "0" || "$(pgrep -fc force-update "${USER}" "/bin/bash ./${selfname} fu")" != "0" ]]; then
|
|
|
- fn_print_dots "Checking update: "
|
|
|
+ fn_print_dots "Checking update:"
|
|
|
fn_print_checking_eol
|
|
|
- fn_print_info "Checking update: LinuxGSM is updating the game server: "
|
|
|
+ fn_print_info "Checking update: LinuxGSM is updating the game server:"
|
|
|
fn_print_info_eol_nl
|
|
|
fn_script_log_pass "Checking update: LinuxGSM is updating the game server"
|
|
|
core_exit.sh
|
|
|
@@ -159,10 +159,10 @@ fn_monitor_check_update() {
|
|
|
fn_monitor_check_update_source() {
|
|
|
if [ -f "${consolelogdir}/${selfname}-console.log" ] && [ "${engine}" == "source" ]; then
|
|
|
if grep -q "Your server needs to be restarted in order to receive the latest update." "${consolelogdir}/${selfname}-console.log"; then
|
|
|
- fn_print_dots "Checking update: "
|
|
|
+ fn_print_dots "Checking update:"
|
|
|
fn_print_checking_eol
|
|
|
fn_script_log_info "Checking update: CHECKING"
|
|
|
- fn_print_ok "Checking update: "
|
|
|
+ fn_print_ok "Checking update:"
|
|
|
fn_print_ok_eol_nl
|
|
|
fn_script_log_info "Checking update: ${selfname} has requested an update and needs to be restarted"
|
|
|
alert="update-request"
|
|
|
@@ -174,7 +174,7 @@ fn_monitor_check_update_source() {
|
|
|
}
|
|
|
|
|
|
fn_monitor_check_session() {
|
|
|
- fn_print_dots "Checking session: "
|
|
|
+ fn_print_dots "Checking session:"
|
|
|
fn_print_checking_eol
|
|
|
fn_script_log_info "Checking session: CHECKING"
|
|
|
# Tmux session width and height needs to be reviewed as may no longer be required.
|
|
|
@@ -182,7 +182,7 @@ fn_monitor_check_session() {
|
|
|
sessionheight="23"
|
|
|
# Check for PIDS with identical tmux sessions running.
|
|
|
if [ "$(pgrep -fcx "tmux -L ${socketname} new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}")" -ge "2" ]; then
|
|
|
- fn_print_error "Checking session: There are PIDS with identical tmux sessions running: "
|
|
|
+ fn_print_error "Checking session: There are PIDS with identical tmux sessions running:"
|
|
|
fn_print_error_eol_nl
|
|
|
fn_script_log_error "Checking session: ERROR"
|
|
|
fn_script_log_error "Checking session: There are PIDS with identical tmux sessions running"
|
|
|
@@ -192,7 +192,7 @@ fn_monitor_check_session() {
|
|
|
core_exit.sh
|
|
|
# Check for tmux pids with the same tmux session and socket names. This will reduce issues with migration to release v23.5.0. #4296
|
|
|
elif [ "$(pgrep -fc -u "${USER}" "tmux -L ${sessionname} new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}")" != "0" ]; then
|
|
|
- fn_print_error "Checking session: PIDS with the same tmux session and socket names are running: "
|
|
|
+ fn_print_error "Checking session: PIDS with the same tmux session and socket names are running:"
|
|
|
fn_print_error_eol_nl
|
|
|
fn_script_log_error "Checking session: ERROR"
|
|
|
fn_script_log_error "Checking session: PIDS with the same tmux session and socket names are running"
|
|
|
@@ -202,7 +202,7 @@ fn_monitor_check_session() {
|
|
|
core_exit.sh
|
|
|
# Check for tmux pids that are using the old type of tmux session. This will reduce issues with migration to release v23.5.0. #4296
|
|
|
elif [ "$(pgrep -fc -u "${USER}" "tmux new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}")" != "0" ]; then
|
|
|
- fn_print_error "Checking session: PIDS with old type tmux session are running: "
|
|
|
+ fn_print_error "Checking session: PIDS with old type tmux session are running:"
|
|
|
fn_print_error_eol_nl
|
|
|
fn_script_log_error "Checking session: ERROR"
|
|
|
fn_script_log_error "Checking session: PIDS with old type tmux session are running"
|
|
|
@@ -211,7 +211,7 @@ fn_monitor_check_session() {
|
|
|
command_restart.sh
|
|
|
core_exit.sh
|
|
|
elif [ "${status}" != "0" ]; then
|
|
|
- fn_print_ok "Checking session: "
|
|
|
+ fn_print_ok "Checking session:"
|
|
|
fn_print_ok_eol_nl
|
|
|
fn_script_log_pass "Checking session: OK"
|
|
|
# send LinuxGSM stats if monitor is OK.
|
|
|
@@ -219,7 +219,7 @@ fn_monitor_check_session() {
|
|
|
info_stats.sh
|
|
|
fi
|
|
|
else
|
|
|
- fn_print_error "Checking session: "
|
|
|
+ fn_print_error "Checking session:"
|
|
|
fn_print_fail_eol_nl
|
|
|
fn_script_log_fail "Checking session: FAIL"
|
|
|
alert="monitor-session"
|
|
|
@@ -233,7 +233,7 @@ fn_monitor_check_session() {
|
|
|
# Monitor will check queryport is set before continuing.
|
|
|
fn_monitor_check_queryport() {
|
|
|
if [ -z "${queryport}" ] || [ "${queryport}" == "0" ]; then
|
|
|
- fn_print_dots "Checking port: "
|
|
|
+ fn_print_dots "Checking port:"
|
|
|
fn_print_checking_eol
|
|
|
fn_script_log_info "Checking port: CHECKING"
|
|
|
if [ -n "${rconenabled}" ] && [ "${rconenabled}" != "true" ] && [ "${shortname}" == "av" ]; then
|
|
|
@@ -266,12 +266,12 @@ fn_monitor_query() {
|
|
|
totalseconds=0
|
|
|
for queryattempt in {1..5}; do
|
|
|
for queryip in "${queryips[@]}"; do
|
|
|
- fn_print_dots "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: "
|
|
|
+ fn_print_dots "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}:"
|
|
|
fn_print_querying_eol
|
|
|
fn_script_log_info "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt} : QUERYING"
|
|
|
# querydelay
|
|
|
if [ "$(head -n 1 "${lockdir}/${selfname}-started.lock")" -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_script_log_info "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt} : DELAY"
|
|
|
fn_script_log_info "Query bypassed: ${gameservername} started less than ${querydelay} minutes ago"
|
|
|
@@ -293,7 +293,7 @@ fn_monitor_query() {
|
|
|
|
|
|
if [ "${querystatus}" == "0" ]; then
|
|
|
# Server query OK.
|
|
|
- fn_print_ok "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: "
|
|
|
+ fn_print_ok "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}:"
|
|
|
fn_print_ok_eol_nl
|
|
|
fn_script_log_pass "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt} : OK"
|
|
|
monitorpass=1
|
|
|
@@ -323,14 +323,14 @@ fn_monitor_query() {
|
|
|
core_exit.sh
|
|
|
else
|
|
|
# Server query FAIL.
|
|
|
- fn_print_fail "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: "
|
|
|
+ fn_print_fail "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}:"
|
|
|
fn_print_fail_eol
|
|
|
fn_script_log_warn "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt} : FAIL"
|
|
|
# Monitor will try gamedig (if supported) for first 30s then gsquery before restarting.
|
|
|
# gsquery will fail if longer than 60s
|
|
|
if [ "${totalseconds}" -ge "59" ]; then
|
|
|
# Monitor will FAIL if over 60s and trigger gane server reboot.
|
|
|
- fn_print_fail "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}: "
|
|
|
+ fn_print_fail "Querying port: ${querymethod}: ${queryip}:${queryport} : ${totalseconds}/${queryattempt}:"
|
|
|
fn_print_fail_eol_nl
|
|
|
fn_script_log_warn "Querying port: ${querymethod}: ${queryip}:${queryport} : ${queryattempt} : FAIL"
|
|
|
# Send alert if enabled.
|