[launchd-dev] Creating a Launch Agent (per user) on demand when client app is open

Piotr Panasewicz piotr.panasewicz at mac.com
Fri Jan 16 04:21:25 PST 2015

Seems I will encounter the same issues I am having now with listening on localhost or socket port option.

In my current implementation the agent sometimes starts as the second logged in user via fast user switching (so both sessions are GUI sessions and active at the time). So if I have an agent (with plist inside /Library/LaunchAgents, so it will work for each user logged in) monitoring localhost or the specific socket port, for which user the agent will run? Because both sessions are active and have GUI. How will I communicate with the one I want if the IPC between my app and the agent is base on one socket port 9977? If I run my app as User A I want the service to run only for the User A, not User B, or both.


> On 16 Jan 2015, at 09:11, Per Olofsson <per.olofsson at gu.se> wrote:
> 15 jan 2015 kl. 17:59 skrev Piotr Panasewicz <piotr.panasewicz at mac.com>:
>> Is it possible to do that without XPC?
> Yes, you can have the agent listen on a localhost or unix domain socket:
> https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html#//apple_ref/doc/uid/10000172i-SW7-SW4
> https://developer.apple.com/library/mac/samplecode/SampleD/Introduction/Intro.html#//apple_ref/doc/uid/DTS10003653
> -- 
> Per Olofsson, IT-service, University of Gothenburg
> _______________________________________________
> launchd-dev mailing list
> launchd-dev at lists.macosforge.org
> https://lists.macosforge.org/mailman/listinfo/launchd-dev

More information about the launchd-dev mailing list