erl -detached doesn't properly detach itself (or does it?)

matthias@REDACTED matthias@REDACTED
Thu Jan 10 00:31:01 CET 2002


Hi,

I was trying to get an erlang process to run as a daemon on my linux
box using the '-detached' option at startup. This doesn't seem to
work quite right---a background emulator is started, but it is killed
whenever I log out of the system.

>From the 'erl' manpage:

         -detached:
             Starts  the  Erlang  system detached from the system
             console. Useful for running daemons and  backgrounds
             processes.

Looking at the source in erlexec.c, I see the fork() calls, but I
don't see a setsid() call. My (rusty) recollections of unix process
groups is that you need to call setsid() to make sure you don't
eventually get a SIGHUP.

Or is there a reason for not calling setsid()?

Matthias



More information about the erlang-questions mailing list