I noticed in this support article it says you have to take down your node to measure your earnings and suggests copying the data folder to prevent concurrent access corrupting the db. What I did to test it out without taking down the server was this:
- Created sandbox directory and go into it.
- made a shell script like this
#!/usr/bin/env bash set -ex rsync -avr --exclude="blobs" ../data . python3 earnings.py data/
- Then I just run it with sudo and it usually works fine (sometimes you catch the db in a bad state and it fails). If if fails I just run it again and it works.
It’s also a bit faster since I leave out all the blobs stored in the data dir.