-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathrun.sh
executable file
·31 lines (27 loc) · 1.04 KB
/
run.sh
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
NODE_0_LOG="./node_0.log"
NODE_1_LOG="./node_1.log"
NODE_2_LOG="./node_2.log"
NODE_3_LOG="./node_3.log"
rm -rf ./node_*.log
function quoted {
SPACE=""
for arg in "$@"; do
printf "%s" "$SPACE\"$arg\""
SPACE=" "
done
printf "\n"
}
tmux new-session -d -s "demo" \; \
new-window -t "demo" \; \
\
split-window -t "demo:0" -v \; \
split-window -t "demo:0.0" -h \; \
split-window -t "demo:0.2" -h \; \
\
send-keys -t "demo:0.0" "go run ./samples/chat-demo -i samples/chat-demo/membership-4 $(quoted "$@") 0 2>&1 | tee \"$NODE_0_LOG\"" Enter \; \
send-keys -t "demo:0.1" "go run ./samples/chat-demo -i samples/chat-demo/membership-4 $(quoted "$@") 1 2>&1 | tee \"$NODE_1_LOG\"" Enter \; \
send-keys -t "demo:0.2" "go run ./samples/chat-demo -i samples/chat-demo/membership-4 $(quoted "$@") 2 2>&1 | tee \"$NODE_2_LOG\"" Enter \; \
send-keys -t "demo:0.3" "go run ./samples/chat-demo -i samples/chat-demo/membership-4 $(quoted "$@") 3 2>&1 | tee \"$NODE_3_LOG\"" Enter \; \
attach-session -t "demo:0.0"
#!/usr/bin/env bash
set -eu