[erlang-questions] Start erl in daemon mode at boot
Rapsey
rapsey@REDACTED
Thu May 12 08:54:30 CEST 2011
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.
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 <comptekki@REDACTED> wrote:
> Does this help any:
>
> http://ubuntuforums.org/showthread.php?t=648425
>
> -wes
>
> On Wed, May 11, 2011 at 2:22 PM, Hank Knight <hknight555@REDACTED> 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
> > erlang-questions@REDACTED
> > http://erlang.org/mailman/listinfo/erlang-questions
> >
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110512/14a17463/attachment.htm>
More information about the erlang-questions
mailing list