Skip to content

Commit

Permalink
Merge pull request #15 from RandyMcMillan/more-play-command-1
Browse files Browse the repository at this point in the history
play: add commands & more help
  • Loading branch information
rsafier authored Sep 11, 2021
2 parents 06e8df4 + 7039b1e commit 131bb2b
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/plebnet-playground.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
sudo apt install -y mkdocs
pip install -r docs/requirements.txt
make init report
play
make install
#make uninstall
Expand All @@ -60,6 +61,7 @@ jobs:
sudo apt install -y mkdocs
pip install -r docs/requirements.txt
make init report
play
make install
#make uninstall
58 changes: 39 additions & 19 deletions scripts/play
Original file line number Diff line number Diff line change
Expand Up @@ -35,33 +35,51 @@ export TOR_IMAGE
for ((i=1;i<=$#;i++));
do

if [[ ${!i} = *id ]]; then
if [[ ${!i} = *ids ]]; then
((i++))
echo THUNDERHUB_ID:
echo $THUNDERHUB_ID
echo RTL_ID:
echo $RTL_ID
echo LND_ID:
echo $LND_ID
echo DOCS_ID:
echo $DOCS_ID
echo BITCOIND_ID:
echo $BITCOIND_ID
echo TOR_ID:
echo $TOR_ID
exit

elif [[ ${!i} = *image ]]; then
elif [[ ${!i} = *images ]]; then
((i++))
echo THUNDERHUB_IMAGE:
echo $THUNDERHUB_IMAGE
echo RTL_IMAGE:
echo $RTL_IMAGE
echo LND_IMAGE:
echo $LND_IMAGE
echo DOCS_IMAGE:
echo $DOCS_IMAGE
echo BITCOIND_IMAGES:
echo $BITCOIND_IMAGE
echo TOR_IMAGE:
echo $TOR_IMAGE
exit

elif [[ ${!i} = top ]]; then
((i++))
docker top $BITCOIND_ID
docker top ${!i}
exit

elif [[ ${!i} = start ]]; then
elif [[ ${!i} = *start ]]; then
((i++))
[ -z "$var" ] && echo "playground-bitcoind not running" && echo "make run from folder" && exit
docker exec -it $BITCOIND_ID sh -c "/usr/local/bin/entrypoint &"
docker exec -it $BITCOIND_ID sh -c "/usr/local/bin/bitcoind -daemon -datadir=/home/root/.bitcoin -addnode=umbrel.local &"
docker exec -it $BITCOIND_ID sh -c "/usr/local/bin/bitcoin-cli gettxoutsetinfo"
docker exec -it $BITCOIND_ID sh -c "/usr/local/bin/bitcoin-cli getmininginfo"
docker restart ${!i}
exit

elif [[ ${!i} = stop ]]; then
((i++))
docker stop $BITCOIND_ID
docker stop ${!i}
exit

elif [[ ${!i} = *cli ]]; then
Expand Down Expand Up @@ -90,22 +108,24 @@ do
elif [[ ${!i} == *help ]]; then
((i++))
echo
echo "play <command> - execute shell command in container"
echo "play -d '<command>' - send command to bitcoind"
echo "play -cli '<command>' - send command to bitcoin-cli"
echo "play ids"
echo "play top <CONTAINER_ID>"
echo "play start <CONTAINER_ID>"
echo "play stop <CONTAINER_ID>"
echo
echo "Examples:"
echo
echo "play ls"
echo "play cd / & ls -a"
echo "play -cli gettxoutsetinfo"
echo "play -cli getmininginfo"
echo "play -cli 'getblockhash 1000'"
echo "docker exec -it <CONTAINER_ID> sh - enter container shell"
echo
echo "playground-bitcoind"
echo
echo "docker exec -it $BITCOIND_ID sh -c '/usr/local/bin/bitcoind -daemon -prune=550'"
echo "play -cli gettxoutsetinfo"
echo "docker exec -it $BITCOIND_ID sh -c '/usr/local/bin/bitcoin-cli gettxoutsetinfo'"
echo "play -cli getmininginfo"
echo "docker exec -it $BITCOIND_ID sh -c '/usr/local/bin/bitcoin-cli getmininginfo'"
echo "play -cli 'getblockhash 1000'"
echo "docker exec -it $BITCOIND_ID sh -c '/usr/local/bin/bitcoin-cli $1'"
echo
exit

elif [ -n ${!i} ]; then
Expand Down

0 comments on commit 131bb2b

Please sign in to comment.