-
Notifications
You must be signed in to change notification settings - Fork 1
/
util-fns.sh
74 lines (67 loc) · 1.75 KB
/
util-fns.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
# set -e
run_cmd(){
echo ""
echo ""
echo "--------------------------------------------------------------------------------------"
echo "--------------------------------------------------------------------------------------"
execCmd=$1;
if [ -n "$DETACHED" ]
then
echo "running detached: $execCmd"
eval "$execCmd"
else
if [ -n "$WITH_TERMINAL" ]
then
execCmd="$WITH_TERMINAL $execCmd"
fi;
echo "running: $execCmd &"
eval "$execCmd" &
fi;
echo "--------------------------------------------------------------------------------------"
echo ""
echo ""
echo ""
}
cleanup() {
echo "cleaning up"
if [ -n "$ejsPid" ]
then
case $ELCLIENT in
ethereumjs)
ejsPidBySearch=$(ps x | grep "ts-node bin/cli.ts --dataDir $DATADIR/ethereumjs" | grep -v grep | awk '{print $1}')
;;
geth)
ejsPidBySearch=$(ps x | grep "$elDataDirSource/geth" | grep -v grep | awk '{print $1}')
;;
*)
echo "ELCLIENT=$ELCLIENT not implemented"
esac
echo "cleaning ethereumjs pid:${ejsPid} ejsPidBySearch:${ejsPidBySearch}..."
if [ -n "$ELCLIENT_IMAGE" ]
then
docker rm execution${MULTIPEER} -f
else
kill $ejsPidBySearch
fi;
fi;
if [ -n "$lodePid" ]
then
lodePidBySearch=$(ps x | grep "$DATADIR/lodestar" | grep -v grep | awk '{print $1}')
echo "cleaning lodestar pid:${lodePid} lodePidBySearch:${lodePidBySearch}..."
if [ ! -n "$LODE_BINARY" ]
then
docker rm beacon${MULTIPEER} -f
else
kill $lodePidBySearch
fi;
fi;
if [ -n "$postPid" ]
then
postPidBySearch=$(ps x | grep "tx-post.sh" | grep -v grep | awk '{print $1}')
kill $postPidBySearch
fi;
ejsPid=""
lodePid=""
postPid=""
}