Re: Launch Daemon Best Practices?
Re: Launch Daemon Best Practices?
- Subject: Re: Launch Daemon Best Practices?
- From: "Hamish Allan" <email@hidden>
- Date: Wed, 12 Mar 2008 00:44:27 +0000
On Wed, Mar 12, 2008 at 12:18 AM, Chris Suter
<email@hidden> wrote:
> I'm not so sure it's a good idea. The problem is that it relies on
> your daemon running which whilst might be true most of the time, it
> might not be—if it's restarting for example. I personally would write
> the defaults from the GUI application.
That's fine as long as the background app is actually a user agent,
but Karl described it as a daemon. So whose defaults should the GUI
app write to? If it's going to write to /Library/Preferences, it's
going to need authorization -- though maybe it will need that anyway.
While the daemon is restarting, you can simply disable all controls
that could change the defaults. Whether or not it makes sense to allow
changes without asking the daemon depends on what sort of task the
daemon is performing.
> No I don't think they will. If you're running as root, preferences
> will get written to /var/root/Library/Preferences
True.
> which is not what you want.
Probably not, but then again it may not be important.
> To write to /Library/Preferences I think you'll need to use
> CFPreferencesSetValue.
Or you could probably set up your own NSUserDefaults with only
NSGlobalDomain in its search list, instead of using
standardUserDefaults.
> If you can get away with it you could just periodically check to see
> if the defaults have changed.
If you don't care whether or not the GUI has the latest information
about the daemon, I really can't see that you'd care about something
like disabling the controls whilst the daemon is restarting.
Hamish
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden