-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
36 lines (29 loc) · 882 Bytes
/
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
31
32
33
34
35
36
#!/bin/bash
# Define the directory to list
dir="./data/client_dataset"
# Create an empty array to store the file names
files=()
# Loop through each file in the directory
for file in $dir/*
do
# Check if the file is a regular file and ends with ".csv"
if [[ -f $file && $file == *.csv ]]; then
# Add the file to the array
files+=("$file")
fi
done
# Print the array of file names
echo "${files[@]}"
length=${#files[@]}
last_index_for_array=$length
((last_index_for_array--))
python server.py &
sleep 5 # Sleep for 2s to give the server enough time to start
for i in `seq 0 1 ${last_index_for_array}`; do
echo "Starting client $i"
python client.py -p "${files[i]}" -c "${i}" &
done
# This will allow you to use CTRL+C to stop all background processes
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM
# Wait for all background processes to complete
wait