[daemon] refactor demonizing into server.Demonize()