diff --git a/lgsm/modules/command_start.sh b/lgsm/modules/command_start.sh index 1302d0d99..cabccac47 100644 --- a/lgsm/modules/command_start.sh +++ b/lgsm/modules/command_start.sh @@ -48,16 +48,6 @@ fn_start_tmux() { fn_reload_startparameters - # Create uid to ensure unique tmux socket name. - if [ ! -f "${datadir}/${selfname}.uid" ]; then - # stop running server (if running) to prevent lingering tmux sessions. - exitbypass=1 - command_stop.sh - uid=$(date '+%s' | sha1sum | head -c 8) - echo "${uid}" > "${datadir}/${selfname}.uid" - socketname="${sessionname}-$(cat "${datadir}/${selfname}.uid")" - fi - if [ "${shortname}" == "av" ]; then cd "${systemdir}" || exit else @@ -181,7 +171,7 @@ fn_start_tmux() { check.sh # If user ran the start command monitor will become enabled. -if [ "${firstcommandname}" == "START" ]||[ "${firstcommandname}" == "RESTART" ]; then +if [ "${firstcommandname}" == "START" ] || [ "${firstcommandname}" == "RESTART" ]; then date '+%s' > "${lockdir:?}/${selfname}-monitoring.lock" fi diff --git a/linuxgsm.sh b/linuxgsm.sh index 331a61822..03ae4a434 100755 --- a/linuxgsm.sh +++ b/linuxgsm.sh @@ -36,7 +36,7 @@ tmpdir="${lgsmdir}/tmp" datadir="${lgsmdir}/data" lockdir="${lgsmdir}/lock" sessionname="${selfname}" -[ -f "${datadir}/${selfname}.uid" ] && socketname="${sessionname}-$(cat "${datadir}/${selfname}.uid")" || socketname="${sessionname}" +socketname="${sessionname}-$(cat "${datadir}/${selfname}.uid")" serverlist="${datadir}/serverlist.csv" serverlistmenu="${datadir}/serverlistmenu.csv" [ -n "${LGSM_CONFIG}" ] && configdir="${LGSM_CONFIG}" || configdir="${lgsmdir}/config-lgsm" @@ -413,6 +413,17 @@ else fi fi fi + + # Create uid to ensure unique tmux socket name. + if [ ! -f "${datadir}/${selfname}.uid" ]; then + # stop running server (if running) to prevent lingering tmux sessions. + exitbypass=1 + command_stop.sh + uid=$(date '+%s' | sha1sum | head -c 8) + echo "${uid}" > "${datadir}/${selfname}.uid" + socketname="${sessionname}-$(cat "${datadir}/${selfname}.uid")" + fi + # Load the IP details before the first config is loaded. check_ip.sh # Configs have to be loaded twice to allow start startparameters to pick up all vars