• 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: Load launchd job immediately, without restart - how?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Load launchd job immediately, without restart - how?


  • Subject: Re: Load launchd job immediately, without restart - how?
  • From: Dimitris Roilidis <email@hidden>
  • Date: Tue, 30 Sep 2008 02:20:14 +0300

OK I checked and tested the code, and it seems to work just fine. Had to make a few minor tweaks 'cause of compiler warnings, and also added the -unload command, but otherwise, it's just what I needed. Many thanks!

Now all I need is to determine what happens if the PrefPane is deleted without having a chance to unload and delete the plist. Hate leaving garbage behind...

Thanks again
D. Roilidis

On Sep 29, 2008, at 4:23 PM, Dimitris Roilidis wrote:

(Oops, hit reply and forgot to change the address to cocoa-dev)

Thanks for the tip! This looks like what I had in mind, I'll give it a spin.

Regarding the "original" route I mentioned, there is a programmatic way to interface directly with launchd. Look in /usr/include/ launch.h; there's also some Apple sample code (http://developer.apple.com/samplecode/SampleD/ ). However, after looking through the header and the sample, it seems like an awful lot of trouble - and code - for such a minor task (loading/unloading a job).

I find it very strange that it is so easy to register a launchd job, yet so difficult to actually load it.

As an aside, I found Lingon (http://lingon.sourceforge.net/) to be extremely useful when working with launchd plists.

D. Roilidis

On Sep 29, 2008, at 2:58 PM, Jerry Krinock wrote:


On 2008 Sep, 28, at 7:49, Dimitris Roilidis wrote:

I have a PrefPane that acts as a ui for a command line utility (helper). According to the launchd docs, ...To load the helper immediately ... the alternative possibly involves a script to call launchctl


Well, I wouldn't call it an "alternative". I believe it is the only way to do it. If anyone knows a better way, please let us know.

but how would this work

Unfortunately, it looks like a job for NSTask. Try the function SSYLoadLaunchdJob given below and let me know if it works. I'll need to do the same thing soon.


and more importantly, how would it be integrated into the PrefPane code?

Insert the call to SSYLoadLaunchctlJob() any time after you have written your plist file.


the sporadic comments google turned up on the subject say it's not worth the trouble.

I'd like to read those comments if you could find the links in your browser history.


[...]

_______________________________________________

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

_______________________________________________

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

_______________________________________________

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: 
 >Load launchd job immediately, without restart - how? (From: Dimitris Roilidis <email@hidden>)
 >Re: Load launchd job immediately, without restart - how? (From: Jerry Krinock <email@hidden>)
 >Re: Load launchd job immediately, without restart - how? (From: Dimitris Roilidis <email@hidden>)

  • Prev by Date: Re: Passing focus to a control
  • Next by Date: Re: Newbie: Strange problem with NSTableView, check boxes and Core Data
  • Previous by thread: Re: Load launchd job immediately, without restart - how?
  • Next by thread: Problem setting the menu
  • Index(es):
    • Date
    • Thread