Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

launch agent questions



I'm not sure whether these launch agents questions belong here (I cross-posted to cocoa-dev and someone kindly suggested this list) please let me know if this is more appropriate on another list.  Thanks for your help.
 
Hi All,
I have a few questions related to launch agents.  I realize that there is only one launchd per user, so a GUI session and an ssh login session will not have separate launchd’s, and I’m fine with that (otherwise, I believe loginwindow plist would be recommended). 
 
I have a launch agent that I want to run whenever the user logs in via the GUI window.  I noticed that I need to call system(“launchctl unload com.myCompany.myAgent.plist”) at then very end of executable myAgent, in order for my launch agent to be run again after logging out and logging back in via GUI.  Otherwise my launch agent plist remains loaded and the next time I log back in, nothing happens.  Is this method of unloading at the end of the executable reasonable, or is there another more standard way of doing this? 
 
The other thing is if I run my launch agent without the unload compiled in at the very end, then manually unload, and relogin, I get the following error – “CoreMIDI: unable to connect to server init port”.  This is mind boggling to me.  Why would compiling in the unload into my launch agent make a difference?  The CoreMIDI error looks as if it is trying to launch my agent as a daemon, and I don’t see how this arises from not compiling in unload at the end.
 
Also, my launch agent really just fires off some other programs and does some synchronization, so it exits after a few seconds.  Is there any way for me to get around the error “9 more failures without living at least 60 seconds will cause job removal”?  I’d rather not add a sleep(60) in my executable. 
 
Thanks,
Alex
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.