Support manager shell and refactor the init and server script.
Merge branch 'manager-shell'