/ radicle-clean-nodes
radicle-clean-nodes
1 #! /bin/sh 2 3 # From https://radicle.zulipchat.com/#narrow/channel/369873-support/topic/Best.20way.20to.20remove.20other.20nodes.20that.20have.20disappeared.3F/with/528874997 4 5 # This program cleans away nodes that haven't shown signs of life for a while from Radicle's local node data 6 # "for a while" is currently hard coded to 6 months 7 8 RAD_HOME="${RAD_HOME:-"$HOME/.radicle"}" 9 export RAD_HOME 10 11 sqlite3 "$RAD_HOME/node/node.db" \ 12 "delete from addresses where coalesce(last_success, 0) < unixepoch(date('now', '-6 month')) * 1000;" 13 sqlite3 "$RAD_HOME/node/node.db" \ 14 "delete from routing where node not in (select node from addresses);" 15 sqlite3 "$RAD_HOME/node/node.db" \ 16 "delete from routing where timestamp < unixepoch(date('now', '-1 month')) * 1000;" 17 sqlite3 "$RAD_HOME/node/node.db" \ 18 "delete from 'repo-sync-status' where timestamp < unixepoch(date('now', '-1 month')) * 1000;"