-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·46 lines (38 loc) · 1.01 KB
/
run.sh
File metadata and controls
executable file
·46 lines (38 loc) · 1.01 KB
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
#!/bin/bash
export REPLICAS=3
export LOCAL=1
export DOCKER=0
#export CONSIST_TYPE=Sequential
export CONSIST_TYPE=Causal
export RANDOM_REPLICA=0
export DELETE_CAUSAL=1
if [ -d "bin" ]; then
cd bin || exit
rm -f server client
cd .. || exit
fi
# Compilare il server
go build -o bin/server ./main/server
# Compilare il client
go build -o bin/client ./main/client
# Funzione per aprire una nuova finestra del terminale
open_terminal() {
local cmd=$1
if command -v gnome-terminal > /dev/null; then
gnome-terminal -- bash -c "$cmd; exec bash"
elif command -v xterm > /dev/null; then
xterm -hold -e "$cmd"
elif command -v konsole > /dev/null; then
konsole --noclose -e "$cmd"
else
echo "No supported terminal found (gnome-terminal, xterm, konsole)"
exit 1
fi
}
# Lanciare le istanze del server
for ((i=0; i<REPLICAS; i++)); do
open_terminal "./bin/server $i"
echo "Server $i started"
done
open_terminal "./bin/client"
echo "Client started"