Made cron startup more robust

- More safely and platform-agnostically check pid
- Fail gracefully when IMAP fails
- Fail gracefully when MySQL fails