From ac7e8fe4b0726b21299c6fc857c2fec0a5dbf82d Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Mon, 31 Jul 2023 00:03:35 +0100 Subject: [PATCH] refactor: simplify start and stop command checks The code in `command_start.sh` and `command_stop.sh` has been refactored to simplify the checks for the start and stop commands. Instead of checking if `exitbypass` is empty, it now directly checks if `firstcommandname` matches specific values ("START", "RESTART" for start command, and "STOP" for stop command). This change improves readability and reduces unnecessary conditions. --- lgsm/modules/command_start.sh | 2 +- lgsm/modules/command_stop.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lgsm/modules/command_start.sh b/lgsm/modules/command_start.sh index b9061be14..1302d0d99 100644 --- a/lgsm/modules/command_start.sh +++ b/lgsm/modules/command_start.sh @@ -181,7 +181,7 @@ fn_start_tmux() { check.sh # If user ran the start command monitor will become enabled. -if [ -z "${exitbypass}" ]; then +if [ "${firstcommandname}" == "START" ]||[ "${firstcommandname}" == "RESTART" ]; then date '+%s' > "${lockdir:?}/${selfname}-monitoring.lock" fi diff --git a/lgsm/modules/command_stop.sh b/lgsm/modules/command_stop.sh index f1e421579..dc716216f 100644 --- a/lgsm/modules/command_stop.sh +++ b/lgsm/modules/command_stop.sh @@ -282,7 +282,7 @@ fn_stop_pre_check rm -f "${lockdir:?}/${selfname}-started.lock" # If user ran the stop command monitor will become disabled. -if [ -z "${exitbypass}" ]; then +if [ "${firstcommandname}" == "STOP" ];then rm -f "${lockdir:?}/${selfname}-monitoring.lock" fi