Mailing Lists: Apple Mailing Lists

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

Re: Question on using launchd



Thanks for the reply!

I'll definitely read up on those notifications.

Unfortunately, though, the server is a BSD process and is written to be cross-platform. So, I think adding these notifications might make for too many platform-specific changes. I'm also not the server author, so although I can request changes it's generally easier for me to be able to do things without changing it.

launchd's SIGTERM at logout is perfect because the server handles it, so really what I need to know is:

1) When the user of my preferences pane changes the little popup from "launch server manually" to "launch server when I log in", I want my prefs pane to write out the appropriate plist file in ~/Library/ LaunchAgents, then "nudge" launchd to let it know to go ahead and load this "job".

2) When the user sets the menu to "launch server manually", can I configure launchd so that launch is manual, but quit is automatic at logout.

Thanks again,
--Mike


On Jun 8, 2006, at 2:23 PM, Rosyna wrote:

Ack, at 6/8/06, Mike Kobb said:

1) Is it possible to set up launchd to not launch the process at login, but to shut it down at logout?

It may not be necessary. See http://developer.apple.com/qa/qa2001/ qa1133.html for some notifications you can subscribe to that are sent when a user logs out. Granted, the samples are really, really old (in the lifetime of OS X) but they should still be accurate.


2) I want this all to be controlled by my preference pane.
Obviously, it's no trouble to get it to write out the required plist file, but the part I'm not sure about is how to do the equivalent of a "launchctl load" or "launchctl unload" operation. I could exec this, I guess, but I prefer to use a proper C API rather than the exec mechanism whenever I can.

Again, notifications are sexy. If you can reload the preferences and handle the changes without a relaunch, you can just send a notification from the preference pane and receive them in the daemon. This is what I do and it works really well.
--



Sincerely, Rosyna Keller Technical Support/Holy Knight/Always needs a hug

Unsanity: Unsane Tools for Insanely Great People

It's either this, or imagining Phil Schiller in a thong.



--
"In your dreams, you're weightless." -- Astronaut Ed Lu, describing sleeping aboard the International Space Station.



_______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >Question on using launchd (From: Mike Kobb <email@hidden>)
 >Re: Question on using launchd (From: Rosyna <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.