I wrote a little bash a while back, because I'm on a dynamic ip connection and bitcoin doesn't behave so nicely with changing IPs. (see
https://github.com/bitcoin/bitcoin/issues#issue/48 for more info (while the gui still displays connections, the node may in fact be disconnected)).
Since I still wanted to mine solo, I wrote this script.
I've been using it for 6 weeks now, have been mining solo using it for 2 weeks now without problem and I thought it's ripe for sharing:
http://pastebin.com/tFJwFwnsIt works by comparing an "official blockcount" (e.g. from blockexplorer.com) with the local one from rpc interface.
To use it, you should check/edit some variables at the beginning of the script: BITCOIN_BIN, PING_HOST and OFFICIAL_URL
Then just go ahead and run it.
If you want, you can also adjust some timing variables.
Feedback is welcome, also symbolic (0.01 BTC or so) donations to the address in my signature are of course appreciated and also good for your karma