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/Foundati... http://code.google.com/p/google-toolbox-for-mac/source/browse/trunk/Foundati...
Be careful when using this. It will not work for submitting jobs which have Socket services. -- Damien Sorresso BSD Engineering Apple Inc.