Smarter daemonising process