-
Notifications
You must be signed in to change notification settings - Fork 2
/
attach_nodes.sh
executable file
·57 lines (54 loc) · 1.03 KB
/
attach_nodes.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
# !/bin/bash
# by Austin Hester
# Attach nodes
CURR=`dirname $0`
BOOT=$CURR/bootstrap
MINER1=$CURR/miner1
MINER2=$CURR/miner2
if [[ -d $BOOT/geth/ && -d $MINER1/geth/ && -d $MINER2/geth/ ]]
then
# bootstrap node
read -p "Which node do you want to connect to? (b/1/2) : " -r
echo
if [ $REPLY == "b" ]; then
if [ -d $BOOT/geth/ ]; then
BOOTIPC=/home/$USER/.ethereum/geth.ipc
if [ -e $BOOTIPC ]; then
echo "Attaching"
geth attach ipc:$BOOTIPC
else
echo "bootstrap not running."
fi
else
echo "bootstrap not initialized."
fi
fi
# miner 1
if [ $REPLY == "1" ]; then
if [ -d $MINER1/geth/ ]; then
if [ -e $MINER1/geth.ipc ]; then
echo "Attaching"
geth attach $MINER1/geth.ipc
else
echo "miner1 not running."
fi
else
echo "miner1 not initialized."
fi
fi
# miner 2
if [ $REPLY == "2" ]; then
if [ -d $MINER2/geth/ ]; then
if [ -e $MINER2/geth.ipc ]; then
echo "Attaching"
geth attach $MINER2/geth.ipc
else
echo "miner2 not running."
fi
else
echo "miner2 not initialized."
fi
fi
else
echo "You must initialize the chain first"
fi