[launchd-dev] Agent started two different was,
two different bootstraps?
subscriber at gloaming.com
Fri Jan 25 13:31:27 PST 2008
Dave Zarzycki <mailto:zarzycki at apple.com> wrote (Friday, January
25, 2008 12:13 PM -0800):
>-S, not -s, but otherwise, that is probably the solution.
That seems to be the problem.
If I load the agent using
launchctl load com.qrecall.monitor.plist
it doesn't work. It runs, but can't connect to any processes
using Mach ports.
If I unload it and reload it using
launchctl load -S Aqua com.qrecall.monitor.plist
it works! It connects and communicate just fine.
As an experiment, I added
to the plist and tried to load it again, with and without
specifying the sessiontype. Here's what I got:
crocodile:LaunchAgents james$ launchctl load com.qrecall.monitor.plist
nothing found to load
crocodile:LaunchAgents james$ launchctl load -S Aqua com.qrecall.monitor.plist
So it appears issuing "launchctl load" as a user process is
assuming some other kind of sessiontype.
So I think there's definitely a bug here, although it's not the
more overt bug I thought it was.
1) As Hamish pointed out, LimitLoadToSessionType defaults to
Aqua. So in the absence of LimitLoadToSessionType, an agent
should only be loaded in the Aqua bootstrap/sessiontype.
2) If you include the LimitLoadToSessionType=Aqua in the plist,
'launchctl load' ignores the plist with "nothing to load." I now
realize that it's because the session types are different.
3) If you omit the LimitLoadToSessionType in the plist,
'launchctl load' loads the agent in whatever sessiontype it
defaults to, which is in contradiction to (1).
If this sounds reasonable, I'll file a bug report.
In the meantime I'll add -S Aqua to my initial load command.
More information about the launchd-dev