Created
May 31, 2025 18:58
-
-
Save portlandhodl/c198cb591085b34ff0f599b29878fb95 to your computer and use it in GitHub Desktop.
Unix cron script to automatically disconnect Bitcoin Knots peers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get peer info and disconnect any peer with "knots" in the subver field | |
bitcoin-cli getpeerinfo | jq -r '.[] | select(.subver | ascii_downcase | contains("knots")) | .id' | while read peer_id; do | |
if [ ! -z "$peer_id" ]; then | |
echo "Disconnecting peer ID $peer_id with knots client" | |
bitcoin-cli disconnectnode "" "$peer_id" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment