Skip to content

Instantly share code, notes, and snippets.

@oboje
Forked from wallentx/chiastat
Created May 14, 2021 10:26
Show Gist options
  • Save oboje/4701efd8b77a5baa7dabc860e66b02a6 to your computer and use it in GitHub Desktop.
Save oboje/4701efd8b77a5baa7dabc860e66b02a6 to your computer and use it in GitHub Desktop.
Dumping chia info to individual items to query via webserver endpoint
#!/usr/bin/env bash
source /home/your/path/to/chia-blockchain/activate
STR=$(chia farm summary | head -8)
FARM=$(chia farm summary | head -8 | sed 's/ /_/g; s/:_/=/g') #jq -Rs '{chia:split("\n")|map(split(": ")|{(.[0]):.[1]}?)}'
ACTIVE=$(pgrep -fa 'chia plots create' | wc -l)
printem() {
echo "Active_Plots=$ACTIVE"
echo "$FARM"
}
OUTPUT="$(printem | xargs | sed -e 's/ / /g')"
eval $OUTPUT
if [[ ! -d /tmp/chia ]]; then
mkdir -p /tmp/chia
fi
if [[ $Farming_status = "Farming" ]]; then
export FARM=true
else
export FARM=false
fi
echo "chia Active_plots=$ACTIVE" > /tmp/chia/active
echo "chia Farming_status=$FARM" > /tmp/chia/farmstat
echo "chia Total_chia_farmed=$Total_chia_farmed" > /tmp/chia/totalxch
echo "chia Block_rewards=$Block_rewards" > /tmp/chia/xchrewards
echo "chia Plot_count=$Plot_count" > /tmp/chia/plots
echo "chia Total_size_of_plots=$Total_size_of_plots" | rev | cut -c5- | rev > /tmp/chia/plotsize
echo "chia Estimated_network_space=$Estimated_network_space" | rev | cut -c5- | rev > /tmp/chia/netspace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment