From time to time, I’ve observed that certain nodes encounter the “BEACON STALL” status in their Sync State after running the duplicate files script by @J053. These nodes become stuck in this state until a restart. It’s likely that this issue stems from containers not shutting down properly, and I don’t believe it’s a problem with @J053’s script.
To automate the process, you can utilize the provided script. Replace “Key_1” with your node’s Validator Public Key in the script below:
#!/bin/bash
declare -A node_key
node_key=(
["1"]="KEY_1"
["2"]="KEY_2"
["3"]="KEY_3"
# Add more nodes and keys as needed
)
base_url="https://monitor.incognito.org/pubkeystat/stat"
container_name="inc_mainnet_"
for node_name in "${!node_key[@]}"; do
key="${node_key[$node_name]}"
response=$(curl -s "$base_url" -H 'accept: application/json' -H 'content-type: application/json' --data "{\"mpk\":\"$key\"}" | jq -r '.[].SyncState')
if [ "$response" == "BEACON STALL" ]; then
echo -n "Restarting Container "
sudo docker restart "${container_name}${node_name}"
fi
done
sleep 2
exit 0
Save the above code into a file (e.g., stalling.sh
). Replace KEY_X
with your nodes’ keys and add as many as required. Make the script executable with: sudo chmod +x stalling.sh
.
Set up a cron job to run the script at specified intervals. To edit the cron jobs, use the command: sudo crontab -e
. Add a new line at the bottom as follows:
0,30 * * * * /path/to/stalling.sh
This will run the script every 30 minutes. Adjust the frequency as needed.
Congratulations! You’ve successfully established an automated script to monitor and handle “BEACON STALL” containers.
For added convenience, you can follow the instructions on @J053’s GitHub repository:
- Run
crontab -e
.- Add
0 0 * * * deno task --cwd /root/Duplicated-files-cleaner-Incognito run
at the end of the file, adjusting the path if necessary.
Set my script to run approximately 30-60 minutes after to address any “BEACON STALL” containers.
If you have any questions or get stuck on anything feel free to leave a comment below or send me a PM.
If copying and pasting gives you issues, feel free to curl or use git from here:
https://github.com/lukemax47/Node_Stall