mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-12-23 14:55:18 +00:00
Add script for dev test purpose (#288)
Some checks are pending
abi-consistent-check / build-and-compare (push) Waiting to run
code-coverage / unittest-cov (push) Waiting to run
rust / check (push) Waiting to run
rust / test (push) Waiting to run
rust / lints (push) Waiting to run
functional-test / test (push) Waiting to run
Some checks are pending
abi-consistent-check / build-and-compare (push) Waiting to run
code-coverage / unittest-cov (push) Waiting to run
rust / check (push) Waiting to run
rust / test (push) Waiting to run
rust / lints (push) Waiting to run
functional-test / test (push) Waiting to run
* Add script for local startup * requires .env file * fix bash syntax * exit on exception
This commit is contained in:
parent
66544fed0c
commit
d322c38c11
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@ tests/**/__pycache__
|
||||
tests/tmp/**
|
||||
.vscode/*.json
|
||||
/0g-storage-contracts-dev
|
||||
/run/.env
|
||||
|
71
run/zgs.sh
Executable file
71
run/zgs.sh
Executable file
@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ $# -eq 0 ]]; then
|
||||
echo "Usage: zgs.sh start | stop | info | clean"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pid=`ps -ef | grep zgs_node | grep -v grep | awk '{print $2}'`
|
||||
|
||||
case $1 in
|
||||
|
||||
start)
|
||||
if [[ "$pid" = "" ]]; then
|
||||
if [ ! -f .env ]; then
|
||||
echo ".env file not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source .env
|
||||
|
||||
if [[ "$ZGS_NODE__MINER_KEY" = "" ]]; then
|
||||
echo "ZGS_NODE__MINER_KEY not specified in .env file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$ZGS_NODE__BLOCKCHAIN_RPC_ENDPOINT" = "" ]]; then
|
||||
echo "ZGS_NODE__BLOCKCHAIN_RPC_ENDPOINT not specified in .env file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
nohup ../target/release/zgs_node --config config-testnet-turbo.toml \
|
||||
--log-config-file log_config_debug \
|
||||
--miner-key $ZGS_NODE__MINER_KEY \
|
||||
--blockchain-rpc-endpoint $ZGS_NODE__BLOCKCHAIN_RPC_ENDPOINT &
|
||||
|
||||
echo "Storage node started ..."
|
||||
else
|
||||
echo "Storage node already started, pid = $pid"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
stop)
|
||||
if [[ "$pid" = "" ]]; then
|
||||
echo "Storage node not started yet"
|
||||
exit 1
|
||||
else
|
||||
kill $pid
|
||||
echo "Storage node terminated, pid = $pid"
|
||||
fi
|
||||
;;
|
||||
|
||||
info)
|
||||
if [[ "$pid" = "" ]]; then
|
||||
echo "Storage node not started yet"
|
||||
exit 1
|
||||
else
|
||||
curl -X POST --data '{"jsonrpc":"2.0","method":"zgs_getStatus","params":[],"id":1}' \
|
||||
-H "Content-Type: application/json" http://127.0.0.1:5678 | jq -C ".result"
|
||||
fi
|
||||
;;
|
||||
|
||||
clean)
|
||||
rm -rf nohup.out db log
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: zgs.sh start | stop | info | clean"
|
||||
;;
|
||||
|
||||
esac
|
Loading…
Reference in New Issue
Block a user