[erlang-questions] Fwd: Report errors when using "-detached" option

ERLANG <>
Fri Nov 14 14:33:28 CET 2008


Hi Claes,


> This is indeed a real problem. If daemon startup fails, you typically
> want to indicate that through a call to exit(error_code) so that the
> invoker can check $?
>

I'l try that as I didn't know that the "error_code" will be returned  
even
with "-detached" option.

> A tail-f we solved this by hacking the emulator startup a bit. I know
> we sent those patches to otp, but I'm not sure if they were ever
> incorporated.
>
> You can also implement some sort of status checker in your program.
> I a call that connects to the daemon and reports someting, thus  
> startup
> could be:
>
> erl -detached ${flags}
> erl -s mymod check_status
> if [ ! $? = 0 ]; then
>   echo "failed to start bla bla"
>   exit 1
> fi
>

This is excatly what I decided to use but it looks a bit ugly ;-)

Thanks for yout hint ;-)

Regards
Ferret.



More information about the erlang-questions mailing list