mirror of
https://github.com/GameServerManagers/LinuxGSM.git
synced 2025-01-08 12:07:37 +08:00
Added optional pre_restart script to be called when monitor restarts the server
This commit is contained in:
parent
5510a30aee
commit
e9cc5926cc
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user