[launchd-dev] Can a launchd job get any access to its invoking plist?

Damien Sorresso dsorresso at apple.com
Wed Dec 4 12:10:42 PST 2013


On 4 Dec, 2013, at 12:05, Jerry Krinock <jerry at ieee.org> wrote:
> On 2013 Dec 04, at 11:22, Damien Sorresso <dsorresso at apple.com> wrote:
> 
>> Why not just set a relevant environment variable or pass an argument that's different in each plist?
> 
> I’ve done that, Damien, but like Norman I have wondered why the job’s parameters are not more readily available.  

Because the launchd.plist is not a preferences container. It's not meant to be a state store.

> From a shell, you can run launchctl with the subcommand info, and pass the job’s label.  

Yes, but that is only meant for informational purposes; programs should not be making decisions based on that output, and that output is not (and never will be) reflective of the complete contents of the launchd.plist.

If you need to modify your program's behavior, you should specify different arguments or a different environment in the plist. That is what those entries are for.
-- 
Damien Sorresso
dsorresso at apple.com

> It gives you most of the plist, but not all.  WatchPath is one key I recall which is not included.  And, sadly, I don’t think there is any C API equivalent of launchctl.
 


More information about the launchd-dev mailing list