diff --git a/lgsm/modules/command_start.sh b/lgsm/modules/command_start.sh index cabccac47..963815b1b 100644 --- a/lgsm/modules/command_start.sh +++ b/lgsm/modules/command_start.sh @@ -48,6 +48,19 @@ fn_start_tmux() { fn_reload_startparameters + # Create uid to ensure unique tmux socket name. + if [ ! -f "${datadir}/${selfname}.uid" ]; then + check_status.sh + if [ "${status}" != "0" ]; then + # stop running server (if running) to prevent lingering tmux sessions. + exitbypass=1 + command_stop.sh + fi + 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 diff --git a/linuxgsm.sh b/linuxgsm.sh index 76a470a63..19fdf1a54 100755 --- a/linuxgsm.sh +++ b/linuxgsm.sh @@ -414,15 +414,6 @@ else 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 - 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