Fixes to get daemon mode working. And scheduler fixes revealed in the process.

In getting the daemonization code working, several other bugs surfaced in the scheduler. So fixes for those are in here too since the scheduler wouldn't keep running to know if daemon mode was working without the fixes.

Also tweaked the etc dir to match the structure of other projects along with more documented sample configs.