Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added optional pre_restart script to be called when monitor restarts … #4556

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lgsm/modules/command_monitor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,13 @@ fn_monitor_check_update_source() {
fi
}

fn_pre_restart() {
if [ -f "pre_restart" ]; then
fn_script_log_info "Running script pre_restart"
bash pre_restart
fi
}

fn_monitor_check_session() {
fn_print_dots "Checking session: "
fn_print_checking_eol
Expand All @@ -188,6 +195,7 @@ fn_monitor_check_session() {
fn_script_log_error "Checking session: There are PIDS with identical tmux sessions running"
fn_script_log_error "Checking session: Killing all tmux sessions with the socketname name ${socketname} and session name ${sessionname}"
pkill -f "tmux -L ${socketname} new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}"
fn_pre_restart
command_restart.sh
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
Expand All @@ -198,6 +206,7 @@ fn_monitor_check_session() {
fn_script_log_error "Checking session: PIDS with the same tmux session and socket names are running"
fn_script_log_error "Checking session: Killing session with the socketname name ${sessionname} and session name ${sessionname}"
pkill -f "tmux -L ${sessionname} new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}"
fn_pre_restart
command_restart.sh
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
Expand All @@ -208,6 +217,7 @@ fn_monitor_check_session() {
fn_script_log_error "Checking session: PIDS with old type tmux session are running"
fn_script_log_error "Checking session: Killing session with the session name ${sessionname}"
pkill -f "tmux new-session -d -x ${sessionwidth} -y ${sessionheight} -s ${sessionname}"
fn_pre_restart
command_restart.sh
core_exit.sh
elif [ "${status}" != "0" ]; then
Expand All @@ -225,6 +235,7 @@ fn_monitor_check_session() {
alert="monitor-session"
alert.sh
fn_script_log_info "Checking session: Monitor is restarting ${selfname}"
fn_pre_restart
command_restart.sh
core_exit.sh
fi
Expand Down