This is actually just one of the many pitfalls of running an Erlang application as a unix daemon. There are many people who have bumped into this problem. Just search for "erlang as daemon" and you will get tons of search results. The bad thing is that there doesn't seem to be a good solution. Opening port 80 is a small problem compared to the other stuff that can happen. Did anyone try to stop a zotonic instance gone bad? Heart will just happily start it over and over again. And if you kill heart first, erlang will start it again. Killing it manually can be maddening. Especially on a busy server.
Not good IMHO.
Somebody has written en erld in c to make erlang play nice as a unix daemon. Sounds very useful, but not available as open-source (yet).
That made me think. What do we need to make it possible to let an erlang program behave like a proper daemon from erlang itself? In the end all we need is a couple of lousy unix system calls to create a new session, call umask, cwd to root, to detach from the controlling terminal, change uid and gid and stuff. It should be possible to package this in a NIF.
Maas - dusting his copy of "Advanced Unix Programming in the Unix Environment" - Zeeman