<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
The rebar release includes a script that should be suitable for
running the Erlang system as a daemon on OSX.<br>
The command sequence is here:
<a class="moz-txt-link-freetext" href="https://bitbucket.org/basho/rebar/wiki/ReleaseHandling">https://bitbucket.org/basho/rebar/wiki/ReleaseHandling</a><br>
The configuration files I currently like are here (which are largely
defaults):<br>
<a class="moz-txt-link-freetext" href="https://github.com/okeuday/CloudI/blob/master/src/reltool.config.in">https://github.com/okeuday/CloudI/blob/master/src/reltool.config.in</a>
(normal name is reltool.config)<br>
<a class="moz-txt-link-freetext" href="https://github.com/okeuday/CloudI/blob/master/src/rebar.config">https://github.com/okeuday/CloudI/blob/master/src/rebar.config</a><br>
<br>
On 03/27/2011 09:41 PM, Rapsey wrote:
<blockquote
cite="mid:BANLkTimj0=CLHaj-HD4jTJMp-W4wF-QWhw@mail.gmail.com"
type="cite">
<meta http-equiv="Context-Type" content="text/html;
charset=ISO-8859-1">
Mac actually has a pretty nice way to run programs as daemons.
Similar to upstart on linux, but better.<br>
You need a .plist xml. Something like this:<br>
<br>
<?xml version="1.0" encoding="UTF-8"?><br>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "<a
moz-do-not-send="true"
href="http://www.apple.com/DTDs/PropertyList-1.0.dtd">http://www.apple.com/DTDs/PropertyList-1.0.dtd</a>"><br>
<plist version="1.0"><br>
<dict><br>
<key>Label</key><br>
<string>NAME_OF_YOUR_PROGRAM</string><br>
<key>EnvironmentVariables</key><br>
<dict><br>
<key>HOME</key><br>
<string>~</string><br>
</dict><br>
<key>OnDemand</key><br>
<false/><br>
<key>ProgramArguments</key><br>
<array><br>
<string>EXEC_WORD1</string><br>
<string>EXEC_WORD2</string><br>
<string>EXEC_WORDX</string><br>
</array><br>
<key>RunAtLoad</key><br>
<true/><br>
<key>KeepAlive</key><br>
<true/><br>
<key>UserName</key><br>
<string>NAME_OF_USER_TO_RUN_AS</string><br>
<key>Group</key><br>
<string>NAME_OF_GROUP_TO_RUN_AS</string><br>
</dict><br>
</plist><br>
<br>
For every word in your execution line, you need a separate
<string> in ProgramArguments.<br>
Add it to /Library/LaunchDaemons/yourxml.plist<br>
If it's there, it will be executed on startup.<br>
<br>
To load (run): sudo launchctl load
/Library/LaunchDaemons/yourxml.plist<br>
To unload (stop): sudo launchctl unload
/Library/LaunchDaemons/yourxml.plist<br>
<br>
I usually put the erl execution in a bash script and execute the
script in the plist.<br>
<br>
#!/bin/sh<br>
cd /Path/To/My/Ebin<br>
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)"<br>
<br>
You can even see what your program is printing to stdout. If you
run /Applications/Utilities/Console -> Console Messages<br>
<br>
<a moz-do-not-send="true"
href="http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPSystemStartup/Articles/LaunchOnDemandDaemons.html">http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPSystemStartup/Articles/LaunchOnDemandDaemons.html</a><br>
<br>
<br>
Sergej<br>
<br>
<div>On Mon, Mar 28, 2011 at 6:09 AM, Joe Armstrong <span><<a
moz-do-not-send="true" href="mailto:erlang@gmail.com">erlang@gmail.com</a>></span>
wrote:<br>
<blockquote>
I want to run a resident distributed erlang node on my
macbook.
<div>It should be started when I reboot my machine. </div>
<div>It should be restarted if it crashes. Nothing nasty
should happen when I open/close</div>
<div>the lid :-) (I guess I also need to "manage" the
node occasional - so I'd need some</div>
<div>remote control facilities)</div>
<div><br>
</div>
<div>What is "best practice" for doing this - does anybody
maintain scripts of this nature?</div>
<div><br>
</div>
<div>(aside it strikes me that this cannot be an uncommon
problem - since we are now in</div>
<div>uncharted "OS specific" territory it would be nice to
know the answer to this question</div>
<div>for all the other "popular" OSs - any tips ?)</div>
<div><br>
</div>
<div>/Joe</div>
<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a moz-do-not-send="true"
href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a moz-do-not-send="true"
href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br>
</blockquote>
</div>
<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
erlang-questions mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a>
</pre>
</blockquote>
<br>
</body>
</html>