Przeglądaj źródła

Added error for tmux < 1.5

Console logging does not work with tmux 1.5 or less. Added error message
in the log to advise this.
Daniel Gibbs 11 lat temu
rodzic
commit
1c9d22930a
1 zmienionych plików z 8 dodań i 2 usunięć
  1. 8 2
      functions/fn_startserver

+ 8 - 2
functions/fn_startserver

@@ -2,7 +2,7 @@
 # LGSM fn_startserver function
 # Author: Daniel Gibbs
 # Website: http://danielgibbs.co.uk
-# Version: 011214
+# Version: 071214
 
 fn_rootcheck
 fn_syscheck
@@ -36,7 +36,13 @@ fi
 date > "${rootdir}/${lockselfname}"
 cd "${executabledir}"
 tmux new-session -d -s ${servicename} "${executable} ${parms}" 2> "${scriptlogdir}/.${servicename}-tmux-error.tmp"
-tmux pipe-pane -o -t ${servicename} "exec cat >> '${consolelog}'"
+# tmux pipe-pane not supported in tmux versions < 1.6
+if [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd [:digit:]|tail -c 3)" -lt "16" ]; then
+	echo "Console logging disabled: Tmux => 1.6 required" >> "${consolelog}"
+	echo "Currently installed: $(tmux -V)" >> "${consolelog}"
+else
+	tmux pipe-pane -o -t ${servicename} "exec cat >> '${consolelog}'"
+fi
 sleep 1
 tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
 if [ "${tmuxwc}" -eq 0 ]; then