Cartsanov
2 min readDec 16, 2019

Simple monitoring script for geth

I have a small individual start-up where I run geth 24 by 7.

but unfortunately, it stops now and then. Recently I had a bad block issue

that stalls the block syncing I tried to understand the issue i searched many use cases on the forum but no proper response.

Later I have removed chain data altogether upgraded my geth and restarted syncing it was counterproductive it took almost 30 hours to get full sync.

I realized that I should have a monitoring tool that will help me to check the geth is running or not.

So I have created a small snippet of a shell script which will check and sends mail if the geth stops

script

Above script is simple

Line 5 is ncat or nc it is similar to cat but it is for the network .

a good example is given in the link https://www.linuxtechi.com/nc-ncat-command-examples-linux-systems/

$? is the status check

else part is to send if it fails

If it won't fails it will continuously output on the monitor screen

out put screen

Thanks, happy coding :)

Cartsanov
Cartsanov

Written by Cartsanov

I am Writer , Blogger, Creator, Passionate Programmer , Enterpreneur

No responses yet