[erlang-questions 70] Re: starting and managing a resident erlang server on mac (or other OSs)
Mon Mar 28 06:41:59 CEST 2011
Mac actually has a pretty nice way to run programs as daemons. Similar to
upstart on linux, but better.
You need a .plist xml. Something like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "
For every word in your execution line, you need a separate <string> in
Add it to /Library/LaunchDaemons/yourxml.plist
If it's there, it will be executed on startup.
To load (run): sudo launchctl load /Library/LaunchDaemons/yourxml.plist
To unload (stop): sudo launchctl unload /Library/LaunchDaemons/yourxml.plist
I usually put the erl execution in a bash script and execute the script in
erl +Bd +P 1000000 -env ERL_MAX_PORTS 100000 -noinput +K true +A 32 -mnesia
dir '"/Path/To/My/priv/mnesia"' -eval "application:start(MY_APP,permanent)"
You can even see what your program is printing to stdout. If you run
/Applications/Utilities/Console -> Console Messages
On Mon, Mar 28, 2011 at 6:09 AM, Joe Armstrong <> wrote:
> I want to run a resident distributed erlang node on my macbook.
> It should be started when I reboot my machine.
> It should be restarted if it crashes. Nothing nasty should happen when I
> the lid :-) (I guess I also need to "manage" the node occasional - so I'd
> need some
> remote control facilities)
> What is "best practice" for doing this - does anybody maintain scripts of
> this nature?
> (aside it strikes me that this cannot be an uncommon problem - since we are
> now in
> uncharted "OS specific" territory it would be nice to know the answer to
> this question
> for all the other "popular" OSs - any tips ?)
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions