Browse Source

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.
pull/4296/head
Daniel Gibbs 2 years ago
parent
commit
ac7e8fe4b0
  1. 2
      lgsm/modules/command_start.sh
  2. 2
      lgsm/modules/command_stop.sh

2
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

2
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

Loading…
Cancel
Save