#!/bin/sh # msOS reads a custom client's statistics from this file's last line (minerstat's custom-client template): hashrate in # H/s, uptime in seconds, pool, accepted and rejected shares. The agent does not measure hashrate itself (the pool # credits shares and the miner portal shows them), so the rig reports 0 here, as on HiveOS: turn off msOS's zero-hashrate # watchdog for this rig. Uptime is how long the agent has run; the pool is ours. state="${PERYN_STATE_DIR:-/home/minerstat/peryn}" up=0 if [ -f "$state/fleet/status.json" ]; then now=$(date +%s) started=$(stat -c %Y "$state/fleet/status.json" 2> /dev/null || echo "$now") pid=$(pgrep -o -f 'pc-agent( launch --)? supervise' 2> /dev/null | head -n 1) if [ -n "$pid" ] && [ -r "/proc/$pid/stat" ]; then ticks=$(awk '{print $22}' "/proc/$pid/stat") boot=$(awk '/^btime/ {print $2}' /proc/stat) hz=$(getconf CLK_TCK 2> /dev/null || echo 100) started=$((boot + ticks / hz)) fi up=$((now - started)) [ "$up" -ge 0 ] || up=0 fi echo "hashrate_total:0,uptime:$up,pool:pool.peryn.ai:3443,shares_rejected:0,shares_accepted:0"