This is basically a translation of w0rldwind's script. Code unchanged, only translated in English.
Mina will restart when:
- Node block height is lagging behing, or when,
- Node stutus is CONNECTING, LISTENING, OFFLINE, BOOTSTRAP, CATCHUP (Set the appropriate time required to load a node in
m.sh
)
cd
mkdir mrestart && cd mrestart
wget https://raw.githubusercontent.com/Kakashi010/mina/main/m.sh
wget https://raw.githubusercontent.com/Kakashi010/mina/main/alert.py
wget https://raw.githubusercontent.com/Kakashi010/mina/main/id.py
chmod +x m.sh
chmod +x alert.py
chmod +x id.py
sudo apt update
sudo apt install -y python3-pip jq
pip3 install pyTelegramBotAPI
- Register a bot with @BotFather
- Add bot token to
alert.py
andid.py
- Run
python3 id.py
and write "ID" to your bot. Add the received ID to alert.py (tgid
) If you are setting up alert for multiple nodes but want the alerts in the same chat then you only need to run this command once on the first node you configure. - Setup a scheduler
- Insert the below line in
crontab -e
- Insert the below line in
*/5 * * * * cd ~/mrestart && ./m.sh
- Edit Node name as you prefer
- Customize api (if required)
- Edit the "time" required to load a node
- Add restart and additional commands
Thanks to w0rldwind for the original scripts!