forked from ustulation/vault-deployer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart-genesis-node.bash
35 lines (29 loc) · 928 Bytes
/
start-genesis-node.bash
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
#!/bin/bash
## This script copies the node binary to a remote machine and starts a genesis node.
## It prints out the required connection information.
# Required arguments
# IP address of the remote machine
ip=$1
# Node data path
data_path=$2
# Log level
log_level=$3
cd /home/safe
rm -rf ~/.cache/quic-p2p
rm -rf ~/.config/quic-p2p
export RUST_LOG=safe=trace,qu=trace,routing=debug
export RUST_BACKTRACE=1
if [ -d "$data_path" ]; then
rm -rf $data_path/*; # Remove this line to preserve node data
else
mkdir ${data_path}
fi
echo "" > ~/.config/sn_node/node_connection_info.config
nohup ./sn_node ${log_level} --first --ip ${ip} --root-dir "${data_path}" &> "${data_path}"/node.stdout &
sleep 5;
hcc="$(cat ~/.config/sn_node/node_connection_info.config)";
if [[ ${hcc} == "" ]]; then
printf 'Genesis node did not print its connection info or printed it in an unrecognised format\n.';
exit 1;
fi
echo $hcc