On Nov 29, 2007, at 3:50 PM, Hamish Allan wrote:
A quick query: do the five sessiontypes (Aqua, LoginWindow,
Background, StandardIO and System) correspond to the five locations
(~/Library/LaunchAgents, /Library/LaunchAgents,
/Library/LaunchDaemons, /System/Library/LaunchAgents,
/System/Library/LaunchDaemons)?
No, it's not a direct mapping.
If not, how should we interpret the meaning of the sessiontypes?
- LaunchDaemons are always loaded exclusively by the root launchd.
- LaunchAgents are typically loaded by the per-user launchd (unless you log in as root, or have a "LoginWindow" agent as described below).
Here's a summary of sessions:
- LaunchDaemons are only loaded into the "System" session of the root launchd. No per-user launchd has a "System" session.
- Unless otherwise specified by the LimitLoadToSessionType key in the plist, LaunchAgents are loaded into the "Aqua" session.
- The "Aqua" session is the same session all GUI Applications are executed in.
- Logins via SSH, telnet, and others are executed in a "StandardIO" session.
- Each user is given a single "Background" session. Jobs in the "Background" session may live longer than the last logout of the user.
- The "LoginWindow" session is active when the system is at the login window. It disappears once a user as logged in.
The list of directories is the result of:
{LaunchDaemons, LaunchAgents} x {~/Library, /Library, /System/Liberary}
However, ~/Library/LaunchDaemons is omitted because there is not yet a current user when the root launchd starts, and per-user launchd instances never execute daemons.