Skip to content

Commit 16c4493

Browse files
committed
fix(monitor): migration code
1 parent fe610f3 commit 16c4493

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

lgsm/modules/alert.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@ fn_alert_check_update() {
7272
alertbody="${gamename} update available: ${remotebuildversion}"
7373
}
7474

75+
fn_alert_update_restart() {
76+
fn_script_log_info "Sending alert: Restarted"
77+
alertsubject="Alert - ${selfname} - Restarted"
78+
alertemoji="🎮"
79+
alertsound="1"
80+
alerturl="not enabled"
81+
alertbody="${gamename} received update: ${remotebuildversion} and required restarting"
82+
}
83+
7584
fn_alert_permissions() {
7685
fn_script_log_info "Sending alert: Permissions error"
7786
alertsubject="Alert - ${selfname}: Permissions error"
@@ -102,6 +111,8 @@ elif [ "${alert}" == "update" ]; then
102111
fn_alert_update
103112
elif [ "${alert}" == "check-update" ]; then
104113
fn_alert_check_update
114+
elif [ "${alert}" == "update-restart" ]; then
115+
fn_alert_update_restart
105116
elif [ "${alert}" == "config" ]; then
106117
fn_alert_config
107118
fi

lgsm/modules/command_monitor.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ fn_monitor_check_update_source() {
154154
fn_print_ok "Checking update: "
155155
fn_print_ok_eol_nl
156156
fn_script_log_info "Checking update: Monitor is restarting ${selfname} to apply update"
157-
alert="restart"
157+
alert="update-restart"
158158
alert.sh
159159
command_restart.sh
160160
core_exit.sh
@@ -177,7 +177,6 @@ fn_monitor_check_session() {
177177
fn_script_log_error "Checking session: There are PIDS with identical tmux sessions running"
178178
fn_script_log_error "Checking session: Killing all tmux sessions with the socketname name ${socketname} and session name ${sessionname}"
179179
pkill -f "tmux -L ${socketname} new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}"
180-
command_restart.sh
181180
core_exit.sh
182181
# Check for tmux pids with the same tmux session and socket names. This will reduce issues with migration to release v23.5.0. #4296
183182
elif [ "$(pgrep -fc -u "${USER}" "tmux -L ${sessionname} new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}")" != "0" ]; then
@@ -187,7 +186,15 @@ fn_monitor_check_session() {
187186
fn_script_log_error "Checking session: PIDS with the same tmux session and socket names are running"
188187
fn_script_log_error "Checking session: Killing session with the socketname name ${sessionname} and session name ${sessionname}"
189188
pkill -f "tmux -L ${sessionname} new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}"
190-
command_restart.sh
189+
core_exit.sh
190+
# 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
191+
elif [ "$(pgrep -fc -u "${USER}" "tmux new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}")" != "0" ]; then
192+
fn_print_error "Checking session: PIDS with old type tmux session are running: "
193+
fn_print_error_eol_nl
194+
fn_script_log_error "Checking session: ERROR"
195+
fn_script_log_error "Checking session: PIDS with old type tmux session are running"
196+
fn_script_log_error "Checking session: Killing session with the session name ${sessionname}"
197+
pkill -f "tmux new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}"
191198
core_exit.sh
192199
elif [ "${status}" != "0" ]; then
193200
fn_print_ok "Checking session: "

0 commit comments

Comments
 (0)