I wrote this small script for getting a mail-alert if my node stops being ENABLED. This is probably trivial for most of you guys, but I though I´d share if it could help anyone:
This only works on a linux server!
If you are not sure if your VPS has mail setup properly try running:
echo "Test" | mailx -s "Test"
Wait and see if you get any mail. I will not document setting up mail since I did not need to do it :-)
Add this to a file called desire-alert.sh and fill out all the placeholders marked with <>
#!/bin/bash
#This is the transaction containing your 1000 DSR, the result from getnewaddress MN1
tx="0-"
#Look for your node in the masternode list, identified by the transaction
status=$(/home//Desire/src/desire-cli masternode list | grep "$tx");
#Make sure it has the correct status, if not send a mail
if [[ "$status" != *"\"$tx\": \"ENABLED\""* ]]; then
echo "Current status: $status" | mailx -s "Desire masternode is down"
fi
run
chmod o+x desire-alert.sh
Run command:
crontab -e
And add row:
*/5 * * * * /desire-alert.sh
The script will now run every 5 min