2015-05-12 04:11:17 +02:00
|
|
|
#!/usr/bin/env bash
|
2015-05-12 02:14:05 +02:00
|
|
|
|
2015-02-12 22:59:01 +01:00
|
|
|
trap "exit" INT
|
2015-05-12 02:14:05 +02:00
|
|
|
|
2015-05-12 04:11:17 +02:00
|
|
|
if [[ -f $(which ec2metadata 2>/dev/null) ]]
|
2015-05-12 02:14:05 +02:00
|
|
|
then
|
|
|
|
# If ec2 instance then get ips from ec2metadata
|
2015-05-12 05:57:04 +02:00
|
|
|
LOCALIP=$(ec2metadata --local-ipv4)
|
2015-05-12 02:14:05 +02:00
|
|
|
IP=$(ec2metadata --public-ipv4)
|
|
|
|
else
|
|
|
|
# Else get IPs from ifconfig and dig
|
2015-05-12 05:57:04 +02:00
|
|
|
LOCALIP=$(ifconfig | grep 'inet ' | grep -v '127.0.0.1' | head -n1 | awk '{print $2}' | cut -d':' -f2)
|
2015-05-12 02:14:05 +02:00
|
|
|
IP=$(dig +short myip.opendns.com @resolver1.opendns.com)
|
|
|
|
fi
|
|
|
|
|
2015-05-12 05:57:04 +02:00
|
|
|
echo "Local IP: $LOCALIP"
|
2015-05-12 04:19:32 +02:00
|
|
|
echo "Public IP: $IP"
|
|
|
|
|
2015-05-12 04:11:17 +02:00
|
|
|
if [[ -f $(which geth 2>/dev/null) ]]
|
2015-03-20 07:17:13 +01:00
|
|
|
then
|
2015-05-12 04:19:32 +02:00
|
|
|
echo "Starting geth"
|
|
|
|
echo geth -rpc -maxpeers "50" -verbosity "3" -bootnodes "enode://09fbeec0d047e9a37e63f60f8618aa9df0e49271f3fadb2c070dc09e2099b95827b63a8b837c6fd01d0802d457dd83e3bd48bd3e6509f8209ed90dabbc30e3d3@52.16.188.185:30303" -nat "extip:$IP"
|
2015-05-09 19:16:47 +02:00
|
|
|
geth -rpc -maxpeers "50" -verbosity "3" -bootnodes "enode://09fbeec0d047e9a37e63f60f8618aa9df0e49271f3fadb2c070dc09e2099b95827b63a8b837c6fd01d0802d457dd83e3bd48bd3e6509f8209ed90dabbc30e3d3@52.16.188.185:30303" -nat "extip:$IP"
|
2015-05-12 04:11:17 +02:00
|
|
|
elif [[ -f $(which eth 2>/dev/null) ]]
|
2015-05-12 02:14:05 +02:00
|
|
|
then
|
2015-05-12 04:19:32 +02:00
|
|
|
echo "Starting eth"
|
2015-05-12 06:14:39 +02:00
|
|
|
echo eth --bootstrap --peers 50 --remote 52.16.188.185:30303 --mining off --json-rpc -v 5 --public-ip $IP --listen-ip $LOCALIP --master $1
|
|
|
|
eth --bootstrap --peers 50 --remote 52.16.188.185:30303 --mining off --json-rpc -v 5 --public-ip $IP --listen-ip $LOCALIP --master $1
|
2015-03-20 07:17:13 +01:00
|
|
|
else
|
2015-05-12 02:14:05 +02:00
|
|
|
echo "Ethereum was not found!"
|
|
|
|
exit 1;
|
2015-03-20 07:17:13 +01:00
|
|
|
fi
|