Added check to reconnect to database
Merge branch 'master' of https://github.com/megardner/mgautomation