gethup.sh

来源:互联网 发布:java 方法重写有什么用 编辑:程序博客网 时间:2024/06/05 04:24

docker exec -it geth-cluster1 /bin/bash
geth –datadir data0 –networkid 779977 console

root@85547cf26bca:/ethutil# cat gethup.sh #!/bin/bash# Usage:# bash /path/to/eth-utils/gethup.sh <datadir> <instance_name>root=$1  # base directory to use for datadir and logsshiftdd=$1  # double digit instance id like 00 01 02shiftnodegroup=$1  # nodegroup 0,1,2,...shiftmine=$1    # mine Y or Noshift# logs are output to a date-tagged file for each run , while a link is# created to the latest, so that monitoring be easier with the same filename# TODO: use this if GETH not setGETH=geth# geth CLI params       e.g., (dd=04, run=09)datetag=`date "+%c%y%m%d-%H%M%S"|cut -d ' ' -f 5`datadir=$root/data/$dd        # /tmp/eth/04log=$root/log/$dd.$datetag.log     # /tmp/eth/04.09.loglinklog=$root/log/$dd.current.log     # /tmp/eth/04.09.logstablelog=$root/log/$dd.log     # /tmp/eth/04.09.logpassword=$dd            # 04port=303$dd              # 30304rpcport=82$dd            # 8104mkdir -p $root/datamkdir -p $root/logln -sf "$log" "$linklog"# if we do not have an account, create one# will not prompt for password, we use the double digit instance id as passwd# NEVER EVER USE THESE ACCOUNTS FOR INTERACTING WITH A LIVE CHAINif [ ! -d "$root/keystore/$dd" ]; then  echo create an account with password $dd [DO NOT EVER USE THIS ON LIVE]  mkdir -p $root/keystore/$dd  $GETH --datadir $datadir --password <(echo -n $dd) account new# create account with password 00, 01, ...  # note that the account key will be stored also separately outside  # datadir  # this way you can safely clear the data directory and still keep your key  # under `<rootdir>/keystore/dd  cp -R "$datadir/keystore" $root/keystore/$ddfi# echo "copying keys $root/keystore/$dd $datadir/keystore"# ls $root/keystore/$dd/keystore/ $datadir/keystore# mkdir -p $datadir/keystore# if [ ! -d "$datadir/keystore" ]; thenecho "copying keys $root/keystore/$dd $datadir/keystore"cp -R $root/keystore/$dd/keystore/ $datadir/# fiBZZKEY=`$GETH --datadir=$datadir account list|head -n1|perl -ne '/([a-f0-9]{40})/ && print $1'`# bring up node `dd` (double digit)# - using <rootdir>/<dd># - listening on port 303dd, (like 30300, 30301, ...)# - with the account unlocked# - launching json-rpc server on port 81dd (like 8100, 8101, 8102, ...)the_mine=""if [ "$mine"x = "Y"x ]; then  the_mine="--mine --minerthreads 1"else  the_mine="--fast"fithe_bootnodes=""if [[ "$nodegroup"x != "0"x || "$dd"x != "00"x ]]; then  the_bootnodes=`cat $CLUSTER_SHAREDIR/bootnode-ip`  the_bootnodes="--bootnodes $the_bootnodes"fiecho "$GETH --datadir=$datadir $the_mine $the_bootnodes \  --identity="$dd" \  --port=$port \  --unlock=$BZZKEY \  --password=<(echo -n $dd) \  --rpcapi "db,eth,net,web3,admin"  \  --rpc --rpcport=$rpcport --rpccorsdomain '*' $* \  2>&1 | tee "$stablelog" > "$log" &  # comment out if you pipe it to a tty etc."  #--rpc --rpcport=$rpcport --rpccorsdomain '*' $* \$GETH --datadir=$datadir $the_mine $the_bootnodes \  --identity="$dd" \  --port=$port \  --unlock=$BZZKEY \  --password=<(echo -n $dd) \  --rpcapi "db,eth,net,web3,admin"  \  --rpc --rpcport=$rpcport --rpccorsdomain '*' $* \  2>&1 | tee "$stablelog" > "$log" &  # comment out if you pipe it to a tty etc.# to bring up logs, uncomment# tail -f $log

docker run -i blockchain101/ethereum-geth:1.6.5 geth attach http://45.32.36.97:8201

原创粉丝点击