-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsession
executable file
·62 lines (40 loc) · 1.26 KB
/
session
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
# Session Name
SESSION="Donaco"
SESSIONEXISTS=$(tmux list-sessions | grep ${SESSION})
# Only create tmux SESSION if it doesn't already exist
if [ "${SESSIONEXISTS}" = "" ]
then
# Start New Session with our name
tmux start-server
tmux new-session -d -s $SESSION -n Admin
# Creating panes
tmux select-window -t=$SESSION:0
tmux split-window -v
tmux split-window -h
tmux select-pane -t 0
tmux split-window -h
# Create new window and more panes
tmux new-window -t=$SESSION:1 -n 'Work'
tmux split-window -v
tmux split-window -h
tmux select-pane -t 0
tmux split-window -h
# Select each panel and run some command
# C-m equals to press enter key
tmux select-pane -t 0
tmux send-keys -t=$SESSION:1 "cd hack/devel" C-m "clear" C-m
tmux select-pane -t 3
tmux send-keys -t=$SESSION:1 "cd hack/kvb/curso" C-m "clear" C-m
tmux select-pane -t 2
tmux send-keys -t=$SESSION:1 "cd hack/tutoriais" C-m "clear" C-m
tmux select-window -t=$SESSION:0
tmux select-pane -t 2
tmux send-keys -t=$SESSION:1 "df -h" C-m
tmux select-pane -t 1
tmux send-keys -t=$SESSION:0 "su" C-m
tmux select-pane -t 0
tmux send-keys -t=$SESSION:0 "su" C-m
fi
# Attach on session
tmux attach-session -t=$SESSION