Skip to content

Commit ca184e3

Browse files
committed
fix(monitor): migration code
1 parent 8cd16ac commit ca184e3

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lgsm/modules/command_monitor.sh

+8-4
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
1212
fn_firstcommand_set
1313

1414
fn_monitor_check_monitoring() {
15-
# Monitor does not run if lockfile is not found.
16-
if [ ! -f "${lockdir}/${selfname}-monitoring.lock" ]; then
15+
if [ -f "${lockdir}/${selfname}.lock" ]; then
16+
# Part of migration to v23.5.0. #4296
17+
rm -f "${lockdir:?}/${selfname}.lock"
18+
date '+%s' > "${lockdir:?}/${selfname}-monitoring.lock"
19+
elif [ ! -f "${lockdir}/${selfname}-monitoring.lock" ]; then
20+
# Monitor does not run if lockfile is not found.
1721
fn_print_dots "Checking lockfile: "
1822
fn_print_checking_eol
1923
fn_script_log_info "Checking lockfile: CHECKING"
@@ -167,7 +171,7 @@ fn_monitor_check_session() {
167171
sessionheight="23"
168172
# Check for PIDS with identical tmux sessions running.
169173
if [ "$(pgrep -fcx "tmux -L ${socketname} new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}")" -ge "2" ]; then
170-
fn_print_error "Checking session: "
174+
fn_print_error "Checking session: There are PIDS with identical tmux sessions running: "
171175
fn_print_error_eol_nl
172176
fn_script_log_error "Checking session: ERROR"
173177
fn_script_log_error "Checking session: There are PIDS with identical tmux sessions running"
@@ -177,7 +181,7 @@ fn_monitor_check_session() {
177181
core_exit.sh
178182
# Check for tmux pids with the same tmux session and socket names. This will reduce issues with migration to release v23.5.0. #4296
179183
elif [ "$(pgrep -fc -u "${USER}" "tmux -L ${sessionname} new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}")" != "0" ]; then
180-
fn_print_error "Checking session: "
184+
fn_print_error "Checking session: PIDS with the same tmux session and socket names are running: "
181185
fn_print_error_eol_nl
182186
fn_script_log_error "Checking session: ERROR"
183187
fn_script_log_error "Checking session: PIDS with the same tmux session and socket names are running"

0 commit comments

Comments
 (0)