rm -f $basedir/$SERVERNAME.status $basedir/$SERVERNAME.log
echo $$ > $basedir/$SERVERNAME.parent.pid
trap cleanup SIGINT SIGTERM SIGPIPE
+
if [[ "$TMUX" ]]; then
- tmux new-window -n test:$SERVERNAME "bash $basedir/$SERVERNAME.launch"
+ TMUX_CMD=tmux
+ if [[ $TMUX = *tmate* ]]; then
+ TMUX_CMD=tmate
+ fi
+
+ $TMUX_CMD new-window -n test:$SERVERNAME "bash $basedir/$SERVERNAME.launch"
+
+ # tmux seems to lag a bit for new sessions. Don't create them too
+ # quickly one after another
+ sleep .1
else
screen -r -X screen -t test:$SERVERNAME bash $basedir/$SERVERNAME.launch
fi