I have been looking at sysutils/tmux but am unable to figure out if I can start it initially with three windows with an autostart program in each.
Can anyone advise?
Can anyone advise?
tmux new-session -d "cmd1"; tmux new-window "cmd2"; tmux new-window "cmd3"; tmux a
tmux
. You will also assign it a pane number so you can attach and detach from it or where it is positioned in your screen arrangement.#!/bin/bash
# Prerequisites: brew install tmux redis
# Set Session Name
SESSION="Redis local cluster"
SESSIONEXISTS=$(tmux list-sessions 2> /dev/null | grep "$SESSION")
if [ $(uname -p) = "arm" ]
then
BINPATH="/opt/homebrew/bin"
else
BINPATH="/usr/local/bin"
fi
CONFIGPATH=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
# Only create tmux session if it doesn't already exist
if [ "$SESSIONEXISTS" = "" ]
then
# Start New Session with our name
tmux new-session -d -s "$SESSION"
tmux send-keys "cd $CONFIGPATH/7001" C-m "$BINPATH/redis-server $CONFIGPATH/7001/redis.conf" C-m
CLUSTERCMD="redis-cli --cluster create 127.0.0.1:7001 "
for i in $(seq 2 6)
do
tmux split-window -t "$SESSION"
tmux send-keys -t "$SESSION" "cd $CONFIGPATH/700$i" C-m "$BINPATH/redis-server $CONFIGPATH/700$i/redis.conf" C-m
tmux select-layout -t "$SESSION" tiled
CLUSTERCMD="$CLUSTERCMD 127.0.0.1:700$i "
done
CLUSTERCMD="$CLUSTERCMD --cluster-replicas 1"
echo $CLUSTERCMD
echo "Run the command above to create the cluster. Only has to be run once."
fi
# Attach Session, on the Main window
tmux attach-session -t "$SESSION"
I think an overview of the key bindings for copy-paste along with some examples of interaction with the system clipboard are required since its a must have feature for anyone using tmux in a productive workflow.