Skip to content

Instantly share code, notes, and snippets.

@schnell18
Last active April 1, 2023 05:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save schnell18/3e2ecce7da0f81a567f52021645df0d4 to your computer and use it in GitHub Desktop.
Save schnell18/3e2ecce7da0f81a567f52021645df0d4 to your computer and use it in GitHub Desktop.
tmux template
#!/bin/sh
# Check to see if we're already running the session
tmux has-session -t main &> /dev/null
if [ $? != 0 ] ; then
# Create overall tmux session
tmux new-session -d -s main -n java > /dev/null
tmux split-window -v
tmux split-window -h
tmux send-keys -t main:1.1 "cd ~/work" C-m
tmux send-keys -t main:1.2 "cd ~/work" C-m
tmux send-keys -t main:1.3 "cd ~/work && jshell" C-m
# Create window for running nexus
tmux new-window -n nexus
tmux send-keys -t main:2 "cd ~/apps/nexus-3.30.1-01/bin && ./nexus start" C-m
# Create window for running docker-compose
tmux new-window -n docker
tmux split-window -v
tmux split-window -h
tmux send-keys -t main:3.1 "cd ~/virtualenv && docker-compose logs -f" C-m
tmux send-keys -t main:3.2 "cd ~/virtualenv && mysql -u mfg -pabc -P 3307 -h 127.0.0.1" C-m
tmux send-keys -t main:3.3 "cd ~/virtualenv && redis-cli -h 127.0.0.1 -p 6379" C-m
else
echo "tmux session already running, attaching..."
sleep 2
fi
tmux select-window -t 1
tmux attach
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment