Adding some code to easily make a process a daemon.