[erlang-questions] Starting Erlang as a Unix daemon

Bengt Kleberg <>
Thu Jan 8 08:44:34 CET 2009


Greetings,

While I hesitate to call this a good way it is at least possible to use
escript (http://erlang.org/doc/man/escript.html), after you have started
Erlang with run_erl, to check if init has achieved the desired results.

If this sounds unclear I would be glad to help you further.


bengt

On Wed, 2009-01-07 at 17:53 +1100, Sam Bobroff wrote:
> Hello everyone,
> 
> I'm working on a project in Erlang that needs to run as a daemon on a
> Unix machine. I would like to provide feedback from the init script
> that starts the daemon but I'm having trouble finding a good way of
> doing it. For example, I would like this to happen from the shell:
> 
> # /etc/init.d/foo start
> Starting foo... OK
> 
> or 
> 
> # /etc/init.d/foo start
> Starting foo... FAILED
> 
> (If there was a fatal error during startup.)
> 
> I've tried using both "run_erl" and "erl -detached" but both of them
> seem to fork and exit before any user code is run.
> 
> Does anyone know a good way to handle this?
> 
> Thanks in advance,
> Sam.




More information about the erlang-questions mailing list