Skip to content

Instantly share code, notes, and snippets.

@muralisc
Created June 25, 2015 20:42
Show Gist options
  • Save muralisc/4c0b452786fa4b9c811f to your computer and use it in GitHub Desktop.
Save muralisc/4c0b452786fa4b9c811f to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ -z "$TMUX" ]; # if not inside tmux
then
echo outside tmux
tmux start-server
tmux new-session -d
# tmux new-window
fi
# tmux select-window -tHaystack:1
tmux split-window
tmux split-window -h
# select pane 0 of current window
tmux select-pane -t :.0
tmux split-window -h
#commands
C1='tail -f /etc/apache2/error.log'
C2='tail -f /usr/lib/cgi-bin/proxy1.log'
C3='tail -f ~/webq/CapacityEstimator/javapersecond.log'
C4='tail -f ~/webq/CapacityEstimator/javadebug.log'
# INFO
# set pane title using
# ESC ]2; ... ESC \
# printf '\033]2;%s\033\\' 'title goes here'
# here we use the commands itself as the titles
tmux send-keys -t:.0 "printf '\033]2;%s\033\\' $C1" C-m
tmux send-keys -t:.1 "printf '\033]2;%s\033\\' $C2" C-m
tmux send-keys -t:.2 "printf '\033]2;%s\033\\' $C3" C-m
tmux send-keys -t:.3 "printf '\033]2;%s\033\\' $C4" C-m
tmux send-keys -t:.0 "$C1" C-m
tmux send-keys -t:.1 "$C2" C-m
tmux send-keys -t:.2 "$C3" C-m
tmux send-keys -t:.3 "$C4" C-m
if [ -z "$TMUX" ]; # if not inside tmux
then
tmux attach-session
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment