Skip to content

Instantly share code, notes, and snippets.

@thearchitect
Forked from B-Galati/tmux.sh
Created November 2, 2019 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thearchitect/eb15b751ef19e2267994942aa19ebc1a to your computer and use it in GitHub Desktop.
Save thearchitect/eb15b751ef19e2267994942aa19ebc1a to your computer and use it in GitHub Desktop.
tmux script example
#!/bin/bash
tmux has-session -t dev
if [ $? != 0 ]
then
tmux new-session -s dev -n "TEST" -d
tmux split-window -h -t dev:0
tmux split-window -v -t dev:0.1
tmux send-keys -t dev:0.0 'cd ~/foo/bar' C-m
tmux send-keys -t dev:0.1 'autossh -M 0 -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" test@test -t "cd ~/bar;bash"' C-m
tmux send-keys -t dev:0.2 'autossh -M 0 -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" test@test -t "cd ~/bar;bash"' C-m
tmux new-window -n "TEST logs" -t dev
tmux send-keys -t dev:1.0 'multitail -Ev "deprecated" -Ev "Twig_(Function|Filter).*is deprecated" -Ev "\"Twig_(Function|Filter)_Method\" for (function|filter) \"(ld|ladybug_dump)" -Ev "event\\.DEBUG" -Ev "HTTP/1\\.1\" (2|3)" -Ev "snc_redis.INFO" -s 2 -f ~/foo/bar/app/logs/dev.log ~/foo/logs/d.*' C-m
tmux new-window -n "TEST2" -t dev
tmux split-window -h -t dev:2
tmux split-window -v -t dev:2.1
tmux send-keys -t dev:2.0 'cd ~/foo/bar_foo' C-m
tmux send-keys -t dev:2.1 'autossh -M 0 -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" test@test -t "cd ~/bar_foo;bash"' C-m
tmux send-keys -t dev:2.2 'autossh -M 0 -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" test@test -t "cd ~/bar_foo;bash"' C-m
tmux new-window -n "TEST2 logs" -t dev
tmux send-keys -t dev:3.0 'multitail -Ev "deprecated" -Ev "Twig_(Function|Filter).*is deprecated" -Ev "\"Twig_(Function|Filter)_Method\" for (function|filter) \"(ld|ladybug_dump)" -Ev "event\\.DEBUG" -Ev "HTTP/1\\.1\" (2|3)" -Ev "snc_redis.INFO" -s 2 -f ~/foo/bar_foo/app/logs/dev.log ~/foo/logs/foo.*' C-m
tmux new-window -n "TEST3" -t dev
tmux split-window -h -t dev:4
tmux send-keys -t dev:4.0 'autossh -M 0 -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" test@test' C-m
tmux send-keys -t dev:4.1 'autossh -M 0 -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" test@test -t "multitail -Ev \"NotFoundHttpException|MethodNotAllowedHttpException\" -iw \"/mnt/syslog-stage/php/errors/*\" 120"' C-m
tmux new-window -n "TEST4" -t dev
tmux split-window -h -t dev:5
tmux send-keys -t dev:5.0 'autossh -M 0 -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" test@test' C-m
tmux send-keys -t dev:5.1 'autossh -M 0 -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" test@test -t "multitail -Ev \"NotFoundHttpException|MethodNotAllowedHttpException\" -iw \"/mnt/syslog/php/errors/*\" 120"' C-m
tmux new-window -n "dotfiles/doc" -t dev
tmux split-window -h -t dev:6
tmux send-keys -t dev:6.0 'cd ~/dotfiles' C-m
tmux send-keys -t dev:6.0 'cd ~/docs' C-m
tmux select-window -t dev:0
fi
tmux attach -t dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment