forked from altendky/farm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatus
executable file
·64 lines (45 loc) · 2.08 KB
/
status
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
#set -vx
farm=/farm
sites=${farm}/sites
wagons=${farm}/wagons
yards=${farm}/yards
#date --iso-8601=seconds
function heading() {
printf "\n ==== $1\n"
}
all_mounts=$(echo "${sites}"/* "${wagons}"/* "${yards}"/*)
pr --merge --omit-header --width 100 <(chia farm summary | grep -v 'Note: log into your') <(chia wallet show; chia plotnft show | grep -E '(Current difficulty|Points balance):') | grep --color=always -e '^' -e 'Block rewards: [^ ]*'
echo Portable plots: $(find /farm/sites -name '*.plot' 2> /dev/null | grep 'pool\.xch' | wc -l) '('$(du -ach $(find /farm/sites -name '*.plot' 2> /dev/null | grep 'pool\.xch') 2> /dev/null | tail -n 1 | sed 's/\t.*//')')'
echo Plots in the past day: $(find /farm/logs/plots/ -type f -mtime 0 -size +3000c -printf '.' 2> /dev/null | wc -c) / $(find /farm/sites/ -mtime 0 -name '*.plot' -printf '.' 2> /dev/null | wc -c)
heading 'Chia logs'
cat ~/.chia/mainnet/log/debug.log{.1,} | grep -v -P '(Err\.(DOUBLE_SPEND|MEMPOOL_NOT_INITIALIZED)|COIN_AMOUNT_NEGATIVE|Consensus error 124)' | grep -P '(error|Looking up qualities)' | tail -n 10
heading 'Disk usage'
df -h ${all_mounts} | grep -v ' /$' | grep --color=always -P '(^|(99|100)%(?= /farm/[wy]))'
heading 'Drive health'
#for mount in ${all_mounts}; do
# partition=$(findmnt --noheadings --output SOURCE "${mount}")
#
# if [[ "${partition}" ]]; then
# echo " ---- ${partition} -> ${mount}"
#
# # https://unix.stackexchange.com/a/226426
# part=$(basename ${partition})
# disk=$(readlink /sys/class/block/$part)
# disk=${disk%/*}
# disk=/dev/${disk##*/}
#
# sudo smartctl -a "${disk}" | grep -E '(Start_Stop_Count|Spin_Retry_Count)'
# fi
#done
heading 'Memory usage'
free --human
heading 'Processes'
top -b -c -n 1 -p $(pgrep -d',' -f 'chia plots create') | grep -E '(load average|PID USER|chia)'
heading 'Plotting logs'
for log in $(ls "${farm}"/logs/plots/*.log | tail -n 10 | sort --reverse); do
if [[ -f "${log}" ]]; then
echo " ---- ${log}"
grep -E "(Time for phase|Starting phase 1|Total time)" "${log}"
fi
done