[erlang-questions] Start erl in daemon mode at boot

Rapsey <>
Thu May 12 15:57:31 CEST 2011


Unfortunately it did not help.


Sergej

On Thu, May 12, 2011 at 3:06 PM, Antoine Koener <>wrote:

>
> On May 12, 2011, at 08:54 , Rapsey wrote:
>
> My current way to run erlang as daemon in ubuntu:
>
> Script that executes erlang itself with my app:
> #!/bin/sh
> cd /path/to/ebin
> erl +Bd +P 1000000 -env ERL_MAX_PORTS 100000 +K true +A 32 -mnesia dir
> '"/path/to/mnesia"' -eval "myapp:start()"
>
>
> Upstart file. Placed in /etc/init/nameofapp.conf. It runs erlang through
> dtach, which allows me to enter the console at any time and pipes outout to
> a logfile. To attach to erlang simply run: dtach -a /tmp/erl
> There is one problem with this setup. sudo stop name_of_app does not work.
>
>
> What about:
>
> #!/bin/sh
> cd /path/to/ebin
> erl +Bd +P 1000000 -env ERL_MAX_PORTS 100000 +K true +A 32 -mnesia dir
> '"/path/to/mnesia"' -eval "myapp:start()"
>
>
> exec erl +Bd +P 1000000 -env ERL_MAX_PORTS 100000 +K true +A 32 -mnesia dir
> '"/path/to/mnesia"' -eval "myapp:start()"
>
> The stop signal will then be received by erl and not /bin/sh
>
> It will remove the job, but erlang won't actually be killed. If I want to
> turn the daemon off, I have to go to erl console through dtach and execute
> q().
>
> start on filesystem and net-device-up
> stop on runlevel [06]
>
> env HOME=/home/ubuntu
> respawn
> console output
>
> script
> exec start-stop-daemon --name NAME_OF_INSTANCE --start --chuid
> USER_TO_RUN_AS --exec /usr/bin/dtach -- -c /tmp/erl /PATH/TO/SCRIPT >
> /var/log/erl.log
> end script
>
>
> Sergej
>
> On Wed, May 11, 2011 at 10:26 PM, Wes James <> wrote:
>
>> Does this help any:
>>
>> http://ubuntuforums.org/showthread.php?t=648425
>>
>> -wes
>>
>> On Wed, May 11, 2011 at 2:22 PM, Hank Knight <>
>> wrote:
>> > I am trying to start erl in daemon mode, using the -detached parameter.
>> >
>> > It runs correctly when initiated from a command line however it fails
>> > when initiated using rc.local at boot time.
>> >
>> > I am running Erlang on Ubuntu.
>> >
>> > Any ideas on how to get it to run in daemon mode at boot time?
>> >
>> > Thanks,
>> > Hank
>> > _______________________________________________
>> > erlang-questions mailing list
>> > 
>> > http://erlang.org/mailman/listinfo/erlang-questions
>> >
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110512/c88a4ceb/attachment.html>


More information about the erlang-questions mailing list