• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Launch Daemon Best Practices?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Launch Daemon Best Practices?


  • Subject: Re: Launch Daemon Best Practices?
  • From: Chris Suter <email@hidden>
  • Date: Wed, 12 Mar 2008 13:14:07 +1100


On 12/03/2008, at 12:39 PM, Karl Moskowski wrote:

Why would that location be wrong?

If your preferences aren't user specific, I don't think they should be there. You also shouldn't be running your daemon as root unless you absolutely have to.


After Hamish's original response, I thought the way to go would be to create a proxy object that behaves like NSUserDefaults (KVC- and KVO-compliant, so it can be wired up in IB) but really just interacts with a corresponding object in the daemon from DO. That way, the daemon's settings are fresh, and the UI always reflects the correct state.

As I said, I don't think it's a good idea to control your daemon directly from the UI. If your daemon isn't running, you can't use the UI to change the preferences. Likewise, if it crashes whilst you're trying to change something or if it's slow in responding you have to handle that. I personally think you'd be better off writing the preferences and then telling your daemon to refresh.


If you need to get state information out of your daemon, then distributed objects is one way of doing it, but I would put that kind of communication on a separate thread in case your daemon becomes unresponsive for whatever reason. If you just need to find out whether your daemon is running, you could just write a file containing the pid to /var/run like other daemons do. You can then trigger a refresh by sending SIGHUP. Doing things this way allows you to completely control your daemon from the command line which can be desirable for testing and server scenarios.

BTW, which Xcode project template would be most appropriate for this type of launch daemon? CoreFoundation Tool or CoreServices Tool?

I don't know. I doubt there's much difference between the two. It's easy enough to add other frameworks as you need them.


Anyway, this is straying off Cocoa a bit so replies should probably be off-list.

Kind regards,

Chris

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

References: 
 >Launch Daemon Best Practices? (From: Karl Moskowski <email@hidden>)
 >Re: Launch Daemon Best Practices? (From: "Hamish Allan" <email@hidden>)
 >Re: Launch Daemon Best Practices? (From: Karl Moskowski <email@hidden>)
 >Re: Launch Daemon Best Practices? (From: Chris Suter <email@hidden>)
 >Re: Launch Daemon Best Practices? (From: Karl Moskowski <email@hidden>)

  • Prev by Date: Re: Launch Daemon Best Practices?
  • Next by Date: Controlling line tightening
  • Previous by thread: Re: Launch Daemon Best Practices?
  • Next by thread: Window not showing
  • Index(es):
    • Date
    • Thread