forked from AleoNet/snarkOS
-
Notifications
You must be signed in to change notification settings - Fork 19
/
run-core-client.sh
executable file
·48 lines (38 loc) · 1.08 KB
/
run-core-client.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
#!/bin/bash
# USAGE examples:
# CLI with env vars: PEERS=“validator_ip:4130,core_client_ip_1:4130,core_client_ip_2:4130,core_client_ip_3:4130,outer_client_ip_1:4130,... ./run-core-client.sh
# CLI with prompts for vars: ./run-core-client.sh
# If the env var PEERS is not set, prompt for it
if [ -z "${PEERS}" ]
then
read -r -p "Enter the peers (comma-separated) (e.g., “validator_ip:4130,core_client_ip_1:4130,core_client_ip_2:4130,core_client_ip_3:4130,outer_client_ip_1:4130,...): "
PEERS=$REPLY
fi
if [ "${PEERS}" == "" ]
then
echo "Missing peers."
exit 1
fi
COMMAND='cargo run --release -- start --nodisplay --client --node 0.0.0.0:4130 --peers ${PEERS} --verbosity 1 --norest'
for word in $*;
do
COMMAND="${COMMAND} ${word}"
done
function exit_node()
{
echo "Exiting..."
kill $!
exit
}
trap exit_node SIGINT
echo "Checking for updates..."
git stash
rm Cargo.lock
STATUS=$(git pull)
if [ "$STATUS" != "Already up to date." ]; then
echo "Updated code found, cleaning the project"
cargo clean
fi
echo "Running an Aleo Core Client node..."
$COMMAND &
wait