-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo-tunnels.sh
executable file
·42 lines (34 loc) · 1.24 KB
/
demo-tunnels.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
37
38
39
40
41
42
#!/bin/bash
# This array contains the command lines of your programs
commands=(
"dtps-server-example-clock --tcp-host localhost --tcp-port 8081 --tunnel test-dtps1-tunnel.json"
"dtps-proxy --tcp-port 8082 --url https://test-dtps1.duckietown.org/"
"dtps-proxy --tcp-port 8083 --tunnel test-dtps2-tunnel.json --url http://localhost:8084/"
"dtps-proxy --tcp-port 8084 --url http://localhost:8083/"
"dtps-client-stats --inline-data http://localhost:8084/"
)
pids=()
# This trap function will be called when SIGINT is received
trap ctrl_c INT
function ctrl_c() {
# Kill each job id in the list
for pid in ${pids[*]}; do
kill $pid
done
}
# Start all programs in the background
for cmd in "${commands[@]}"; do
echo "Running $cmd"
$cmd &
sleep 10
pids+=("$!")
done
# Wait for all programs to finish
for pid in ${pids[*]}; do
wait $pid
done
# dtps-server-example-clock --tcp-host localhost --tcp-port 8081 --tunnel test-dtps1-tunnel.json
# dtps-proxy --tcp-port 8082 --url https://test-dtps1.duckietown.org/
# dtps-proxy --tcp-port 8083 --tunnel test-dtps2-tunnel.json --url https://localhost:8084/
# dtps-proxy --tcp-port 8084 --url https://localhost:8083/
# dtps-client-stats --inline-data https://localhost:8084/