简体   繁体   中英

Launch Agent running per logged in user

I'm trying to configure a launchd agent which should run on demand when my app wants to communicate with it.

Tried few approaches like using WatchPaths or a socket port but the problem arises when there are few users logged in to the system (via fast user switching).

If I monitor a path or port and User A opens my app, the agent sometimes starts through the User's B session and vice-versa, because they both monitor them.

When I'm logged in as User A, I want the Launch Agent run as this user.

My plist is stored in /Library/LaunchAgents. Any ideas?

将启动代理置于~/Library/LaunchAgents并在用户空间中创建WatchPath(〜/ Library / Application \\ Support / yourApp / watch)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM