mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
Add convenience script to run single instance of swarm with geth support
This commit is contained in:
parent
0ee796632a
commit
1d5c5855e0
1 changed files with 46 additions and 0 deletions
46
swarm/scripts/run-swarm-singleton.sh
Executable file
46
swarm/scripts/run-swarm-singleton.sh
Executable file
|
|
@ -0,0 +1,46 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Working directory
|
||||||
|
cd /tmp
|
||||||
|
|
||||||
|
# Preparation
|
||||||
|
DATADIR=/tmp/BZZ/`date +%s`
|
||||||
|
mkdir -p $DATADIR
|
||||||
|
read -s -p "Enter Password. It will be stored in $DATADIR/my-password: " MYPASSWORD && echo $MYPASSWORD > $DATADIR/my-password
|
||||||
|
echo
|
||||||
|
BZZKEY=$($GOPATH/bin/geth --datadir $DATADIR --password $DATADIR/my-password account new | awk -F"{|}" '{print $2}')
|
||||||
|
|
||||||
|
echo "Your account is ready: "$BZZKEY
|
||||||
|
|
||||||
|
# Run geth in the background
|
||||||
|
nohup $GOPATH/bin/geth --datadir $DATADIR \
|
||||||
|
--unlock 0 \
|
||||||
|
--password <(cat $DATADIR/my-password) \
|
||||||
|
--verbosity 6 \
|
||||||
|
--networkid 322 \
|
||||||
|
--nodiscover \
|
||||||
|
--maxpeers 0 \
|
||||||
|
2>> $DATADIR/geth.log &
|
||||||
|
|
||||||
|
echo "geth is running in the background, you can check its logs at "$DATADIR"/geth.log"
|
||||||
|
|
||||||
|
# Now run swarm in the background
|
||||||
|
$GOPATH/bin/swarm \
|
||||||
|
--bzzaccount $BZZKEY \
|
||||||
|
--datadir $DATADIR \
|
||||||
|
--ethapi $DATADIR/geth.ipc \
|
||||||
|
--verbosity 6 \
|
||||||
|
--maxpeers 0 \
|
||||||
|
--bzznetworkid 322 \
|
||||||
|
&> $DATADIR/swarm.log < <(cat $DATADIR/my-password) &
|
||||||
|
|
||||||
|
|
||||||
|
echo "swarm is running in the background, you can check its logs at "$DATADIR"/swarm.log"
|
||||||
|
|
||||||
|
# Cleaning up
|
||||||
|
# You need to perform this feature manually
|
||||||
|
# USE THESE COMMANDS AT YOUR OWN RISK!
|
||||||
|
##
|
||||||
|
# kill -9 $(ps aux | grep swarm | grep bzzaccount | awk '{print $2}')
|
||||||
|
# kill -9 $(ps aux | grep geth | grep datadir | awk '{print $2}')
|
||||||
|
# rm -rf /tmp/BZZ
|
||||||
Loading…
Reference in a new issue