I used the tmux.sh example from https://wiki.ubuntuusers.de/tmux/#Bedienung . Now I get a message "sessions should be nested with care, unset $TMUX to force" every time I start 'tmux'. But as I understand, tmux isn't nesting in this case.
My tmux.sh looks as follows now:
#!/bin/bash
SESSION=main
#tmux="tmux -2 -f ~/.tmux.conf"
tmux="tmux -2"
# if the session is already running, just attach to it.
$tmux has-session -t $SESSION
if [ $? -eq 0 ]; then
# echo "Session $SESSION already exists. Attaching."
sleep 1
$tmux attach -t $SESSION
exit 0;
else
# create a new session, named $SESSION, and detach from it
$tmux new-session -n Werkbank -d -s $SESSION
$tmux split-window -h -t $SESSION:1
$tmux new-window -n "SysA|SysB" -t $SESSION:2 'ssh A'
$tmux split-window -h -t $SESSION:2 'ssh B'
$tmux new-window -n "GwA|GwB" -t $SESSION:3
$tmux split-window -h -t $SESSION:3
$tmux select-window -t $SESSION:1
$tmux attach -t $SESSION
fi