On Nov 24, 2014, at 6:43 PM, Daniel Johnson <daniel.johnso...@gmail.com> wrote:

> 
> On Nov 24, 2014, at 9:21 AM, Charles Lepple <clep...@gmail.com> wrote:
>> 
>> On Nov 20, 2014, at 10:53 AM, Alexander Hansen <alexanderk.han...@gmail.com> 
>> wrote:
>> 
>>> Yeah, there’s no compelling reason not just to update daemonic 
>>> appropriately for all supported OS X and avoid the potential pitfalls of 
>>> creating the plists manually.  
>> 
>> I started looking into this. In case I get distracted before I make any 
>> progress:
>> 
>> I just ran into this $PATH bug while trying to set up a launchd plist 
>> manually on 10.10:
>> 
>> http://www.openradar.me/18945659
>> 
>> It looks like daemonic writes a script for StartupItems (including the 
>> configured Fink $prefix in the PATH), but I suspect that the intent was for 
>> launchd plists to not use a shell if they could help it. Maybe the script 
>> can exec the daemon instead.
> 
> I've been working on this too. Launchd is much more restrictive about what it 
> can handle. Basically, it needs whatever it runs to be the actual executable 
> so that it can track whether it's running. A script that runs another 
> executable or one that does fork() and exec() (or runs daemon() which does 
> the same thing) can't be used directly by launchd. Sometimes you can get 
> around this by using the real executable instead. For example, starting 
> postfix with "postfix start" is bad but running "master" directly is fine.

Hmm, I think the only hard requirement is that the direct descendent of launchd 
(the first copy of the child process) can't exit. You're right that running 
daemon() breaks that rule, but I think a simple fork-and-exec is okay as long 
as the parent hangs around after the fork.

Put another way, I used a script to get around that $PATH bug mentioned above, 
forgot to use "exec" at the end (so both the script and its child process are 
running, with an intervening "nice") and nothing blew up :-)

> Now MacPorts got around this issue with a utility program called daemondo. 
> You have launchd run daemondo which then runs the program you need and it's 
> responsible for keeping track of the program. Daemondo lets you specify a pid 
> file if needed which can allow it to track things. It acts as an adaptor 
> layer. I've made a daemondo fink package which you can find in 
> experimental/danielj/daemondo.info in CVS.
> 
> I've also started writing a replacement daemonic that writes launchd plist 
> files. I ditched the old C-based daemonic code and rewrote it in Python. 
> Conveniently, the Python standard library has everything needed, even a 
> plistlib to read and write plists so it'll work with the system python 
> without any dependencies. I'm also trying to make it work with existing fink 
> packages with as little change as possible, but a few things will probably 
> need tweaking. Hopefully I'll have something that can be tested soon.

Oh, cool. I'd be happy to help test.

-- 
Charles Lepple
clepple@gmail




------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Fink-devel mailing list
Fink-devel@lists.sourceforge.net
List archive:
http://news.gmane.org/gmane.os.apple.fink.devel
Subscription management:
https://lists.sourceforge.net/lists/listinfo/fink-devel

Reply via email to