Mac QA <mailto:macqaguy@gmail.com> wrote (Tuesday, March 11, 2008 1:41 PM -0400):
The mylaunchagent is invoked just fine. If I do a fast user switch to login another user then a second instance is invoked for the second user. All seems good. However, when the second user logs out the second instance of mylaunchagent continues to stay running even though the user logs out!
There are several levels of "logged in/out". A launchd Aqua session is created when the user logs into the GUI. When the user logs out again, the Aqua session ends. Restrict your user agent to the Aqua session and it should behave the way you are expecting. <key>LimitLoadToSessionType</key> <string>Aqua</string> In contrast, the Background session for a user gets created whenever a process for that user is created. This also gets created when the user logs into the GUI but can just as easily be created by starting a remote terminal session via ssh. The Background session does not end when the user logs out of the GUI. My product actually uses this fact to provide services for users after they log out. -- James Bucanek