Launchd agent not starting
- by Thomi
I'm attempting to write a launchd agent that runs a simple application for every user that logs in to the Mac OS X system.
I have created a file named com.mycompany.myapp.plist and placed it in /Library/LaunchAgents. The contents of that file are:
{
LimitLoadToSessionType = "Aqua";
StartInterval = 10;
OnDemand = NO;
KeepAlive = YES;
RunAtLoad = YES;
Label = "com.mycompany.myapp";
Program = "/Users/thomi/myapp";
ProgramArguments = (
"/Users/thomi/myapp",
"-l",
"-d",
);
}
Initially I didn't have the StartInterval key set, since I thought the agent would start automatically. The problem is that the agent does not start unless I manually issue the following two commands:
launchctl load -S Aqua -D all
launchctl start com.mycompany.myapp
Firther, when I run launchctl list com.mycompany.myapp I get the following output:
{
"Label" = "com.mycompany.myapp";
"LimitLoadToSessionType" = "System";
"OnDemand" = true;
"LastExitStatus" = 0;
"TimeOut" = 30;
"Program" = "/Users/thomi/myapp";
ProgramArguments = (
"/Users/thomi/myapp",
"-l",
"-d",
);
};
Notice that the LimitLoadToSessionType parameter has changed.
Am I missing something here? Is there a different mechanism to start agents like this? Why has the LimitLoadToSessionType property changed?