[launchd-dev] Programmatic interface to launchctl and some other questions, OS X 10.5

Dave MacLachlan dmaclach at gmail.com
Tue Oct 26 15:26:18 PDT 2010


On Oct 26, 2010, at 3:05 PM, Damien Sorresso wrote:

> On Oct 26, 2010, at 2:51 PM, Dave MacLachlan wrote:
>> On Oct 26, 2010, at 5:49 AM, eveningnick eveningnick wrote:
>>> 
>>> I am wondering, if from the launchctl sources (i've heard they are
>>> available) i could extract the code to load/start/unload/list the
>>> agents, instead of calling the "launchctl" terminal application with
>>> fork/exec and waiting in the pipe for their result (and parsing that
>>> result). What i mean is - of course, launchctl and launchd can have
>>> changed with time, and my application will become invalid, but so can
>>> the launchctl's console output, that i'm parsing. And, for example,
>>> when i expect the text "12345 1 com.mycompany.myagent" to be returned
>>> with "launchctl list | grep", i may get something different and think
>>> "Oh well, my agent is not running yet, let's start it again" (this is
>>> just an example). Why is this solution considered to be better than
>>> calling API's directly?
>> 
>> Perhaps these will be of use?
>> 
>> http://code.google.com/p/google-toolbox-for-mac/source/browse/trunk/Foundation/GTMServiceManagement.c
>> http://code.google.com/p/google-toolbox-for-mac/source/browse/trunk/Foundation/GTMServiceManagement.h
> 
> Be careful when using this. It will not work for submitting jobs which have Socket services.

Damien, could you expand on this comment a bit so I can fix it appropriately?

Cheers,
Dave

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/launchd-dev/attachments/20101026/91adddbf/attachment-0001.html>


More information about the launchd-dev mailing list