[erlang-questions] Fwd: Report errors when using "-detached" option
Claes Wikström
klacke@REDACTED
Fri Nov 14 14:22:42 CET 2008
ERLANG wrote:
> Hi Michael,
>
>> then I use application:start(sasl) in my program, and then use rb for
>> looking at all the reports (from an erl shell)
>>
>
> That correct and my apps log everything too. But this will force you
> to use "rb" to check the logs for errors (warnings or watherver).
> This is what I want to avoid.
>
> The main idea here is to be able to return an exit code different from
> 0 to notify
> the shell script that erlang app failed to load for some reason.
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 $?
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
/klacke
More information about the erlang-questions
mailing list