forked from AleoNet/snarkOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-prover.sh
executable file
·64 lines (50 loc) · 1.16 KB
/
run-prover.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
#!/bin/bash
# Have a nice day
# if env var MINER_ADDRESS is not set, prompt for it
if [ -z $MINER_ADDRESS ]
then
read -p "Enter your miner address: "
MINER_ADDRESS=$REPLY
fi
if [ "${MINER_ADDRESS}" == "" ]
then
MINER_ADDRESS="aleo1d5hg2z3ma00382pngntdp68e74zv54jdxy249qhaujhks9c72yrs33ddah"
fi
# if env var OPERATOR_IP_ADDR is not set, prompt for it
if [ -z $OPERATOR_IP_ADDRESS ]
then
read -p "Enter your Operator Server's IP address: "
OPERATOR_IP_ADDR=$REPLY
fi
if [ "${OPERATOR_IP_ADDR}" == "" ]
then
echo "IP Address of Operator server is required to run a prover"
exit 1
fi
COMMAND="cargo run --release -- --prover ${MINER_ADDRESS} --pool $(OPERATOR_IP_ADDR}:4132 --trial --verbosity 2"
for word in $*;
do
COMMAND="${COMMAND} ${word}"
done
function exit_node()
{
echo "Exiting..."
kill $!
exit
}
trap exit_node SIGINT
echo "Running miner node..."
$COMMAND &
while :
do
echo "Checking for updates..."
git stash
rm Cargo.lock
STATUS=$(git pull)
if [ "$STATUS" != "Already up to date." ]; then
echo "Updated code found, rebuilding and relaunching miner"
cargo clean
kill -INT $!; sleep 2; $COMMAND &
fi
sleep 1800;
done