rolled custom daemon code to better match the way daemons are supposed to work under debian.