The simple answer, because it’s Ubuntu, the “harder” answer, because it’s using upstart/systemd.
The answer to make it “automated” as you request, can be found on the forums. Specifically look for one of my posts today where I go almost fully in depth. I forget where.