forked from ElementsProject/confidential-assets-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stop_demo.sh
executable file
·53 lines (42 loc) · 1.18 KB
/
stop_demo.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
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
if [ -e ./demo.tmp ]; then
source ./demo.tmp
gopids=( $dave_pid $alice_pid $charlie_pid $fred_pid $bob_pid )
for pid in "${gopids[@]}"; do
if ps -p $pid > /dev/null ; then
echo "kill -SIGINT $pid"
kill -SIGINT $pid
fi
done
sleep 1
for pid in "${gopids[@]}"; do
if ps -p $pid > /dev/null ; then
echo "kill -9 $pid"
kill -9 $pid
fi
done
dirs=( $dave_dir $alice_dir $charlie_dir $fred_dir $bob_dir )
for dir in "${dirs[@]}"; do
echo "$ELCLI $dir stop"
$ELCLI $dir stop
done
sleep 3
pids=( $dave_dae $alice_dae $charlie_dae $fred_dae $bob_dae )
for pid in "${pids[@]}"; do
if ps -p $pid > /dev/null ; then
echo "kill -9 $pid"
kill -9 $pid
fi
done
rm -f ./demo.tmp
else
echo "kill processes"
# Stop the demo. This script is definitely not the way to do this in a production environment.
# Note that any running elementsd processes WILL be killed unless owned by a different user!
pkill bob
pkill dave
pkill charlie
pkill alice
pkill fred
pkill -9 elementsd
fi