Skip to content

Useful scripts

Ben Gräf edited this page Dec 28, 2017 · 5 revisions

Script to set a command for all miners

#!/bin/bash
baseUrl="http://admin:pass@localhost:3344"
command="UPDATE_CONFIG"

curl "$baseUrl/admin/getClientStatusList" --silent | awk -F"[,:}]" '{for(i=1;i<=NF;i++){if($i~/\042'client_id'\042/){print $(i+1)}}}' | tr -d '"' | sed -n ${num}p | while read -r line ; do
        curl -H "Content-Type: application/json" -X POST -d '{"control_command":{"command":"'$command'"}}' "$baseUrl/admin/setClientCommand?clientId=$line"
done

Script to get a list of all miners

#!/bin/bash
baseUrl="http://admin:pass@localhost:3344"

curl "$baseUrl/admin/getClientStatusList" --silent | awk -F"[,:}]" '{for(i=1;i<=NF;i++){if($i~/\042'client_id'\042/){print $(i+1)}}}' | tr -d '"' | sed -n ${num}p | while read -r line ; do
        echo $line
done
Clone this wiki locally