[launchd-dev] fork & exit in Shell Script (Revisited)

Kevin Elliott kelliott at mac.com
Wed Nov 19 13:02:33 PST 2008

On Nov 19, 2008, at 10:32 AM, Charles Darwin wrote:
> On Nov 19, 2008, at 1:01 PM, Quinn wrote:
>> At 12:51 -0500 19/11/08, Charles Darwin wrote:
>>> LimitLoadToSessionType doesn't do it either.
>> What do you mean by "doesn't do it".  I tested the launchd agent  
>> included in my previous email and, at least on my machine, it ran  
>> once at GUI login and in the GUI login context.
>> S+E
>> -- 
> "it ran once at GUI login"; that's exactly what launchd does. A  
> login item runs "every time" the specified user logs in. So if user  
> log out (not booting the system just logging out useing "Log Out  
> User…" under Apple menu) and then logs back launchd does launch its  
> job again (in this case doesn't mount the afp) whereas a "login  
> item" under user's account settings (system preferences) relaunches  
> whatever it launches normally.

Is this the behavior your seeing on your machine?  It's certainly not  
what launchd is supposed to do, not how it behaves on my machine.  The  
script Quinn posted earlier does exactly what I expected- every time I  
logged in, the script ran.  Login... script run,  logout, login...  
script run.  Frankly, I'm not sure it's possible to configure launchd  
to behave the way your describing (run once at first login, but not on  
subsequent logins).  Quinn would know for sure, but that's certainly  
not the behavior of the script he sent you.

Have you tested the script Quinn sent out on your machine?


More information about the launchd-dev mailing list