Transform the startup/migration actions into a more fully fledged application lifecycle for aprox, which includes shutdown actions too. Fix database setup/shutdown process for the new quartz-based scheduler.