Last active
October 15, 2024 23:37
-
-
Save schnell18/3e2ecce7da0f81a567f52021645df0d4 to your computer and use it in GitHub Desktop.
tmux template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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