James,

Some replies inline...

On 22 Jul, 2015, at 17:46, James Bucanek <subscri...@gloaming.com> wrote:
> Damien,
> 
> Thanks for the suggestion, and apologies for the tardy reply; I just got 
> buried under twenty other to-do items that were higher on the list.
> 
> I tried removing the LimitLoadToSessionType entry from my agent's plist, but 
> it doesn't make any difference. When trying to install it as a system-wide 
> agent, the process still doesn't start.

In launchd's lexicon, "system-wide agent" is a conflict of terminology. 
System-wide things are, by definition, daemons. Agents are things which run on 
a per-user basis (cf. launchd(8)). So the real question is about the desired 
lifecycle of your job. Do you want it to run when a user logs in and to go away 
when the user logs out? Or do you want it to be available regardless of any 
user being logged in?

> My reading of LimitLoadToSessionType would lead me to believe that it's 
> applicable to my service, which *is* an agent. It runs as a regular user, and 
> the docs would indicate that this property is just a hint to the load 
> balancer on how to constrain its use of CPU/memory/IO. It doesn't make sense 
> that it would keep the process from starting in the first place.

Wow, no that's not at all what that key is for. Please file a bug explaining 
how the documentation misled you into that impression so we can make it clearer!

Session types are basically collections of certain kinds of jobs. The "Aqua" 
session is all the jobs associated with a graphical login on the console. By 
default, if your job is an agent, it is loaded into the Aqua session. (That is, 
if no LimitLoadToSessionType key is present.)

The Background session is a collection of jobs that can run on behalf of a user 
even if that user is not logged in at the graphical console. They might be 
doing things like performing Spotlight indexing on that user's home directory 
even when that user isn't logged in for example.

So if you have a vanilla Terminal prompt and do a `launchctl load`, your plist 
will attempt to load in the Aqua session. If that service has 
LimitLoadToSessionType set to "Background", then that load will fail because 
it's attempting to load in the Aqua session and your service has expressed that 
it should only load in the Background session.
-damien

> Anyway, I'm replying to Axel's message with a complete description of what 
> I'm trying to accomplish and exactly what's not working.
> 
> James
> 
>> Damien Sorresso <mailto:dsorre...@apple.com> June 25, 2015 at 8:53 AM
>> James,
>> 
>> Your plist probably has the LimitLoadToSessionType key set to Background, 
>> which will prevent it from loading outside of a user's background session. 
>> So when you do a regular `launchctl load` from a Terminal window (for 
>> example), you're targeting the Aqua session, and launchd says no. Similarly, 
>> if you try and load it into the system session (either by running 
>> launchctl(1) under sudo(1) or by using the bootstrap subcommand with a 
>> "system" target), launchd will also say no.
>> 
>> If you remove the LimitLoadToSession type key, you'll be able to load the 
>> job wherever you'd like.
>> -damien
>> 
> 

_______________________________________________
launchd-dev mailing list
launchd-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/launchd-dev

Reply via email to