On Mon, Mar 15, 2010 at 7:04 AM, dreamcat four <dreamcat4@gmail.com> wrote:
This is of interest to me as I've been wondering for a whiile how to do it in Ruby. Its interesting to see this example of CheckInWithLaunchd() in your code:
http://bitbucket.org/mikemccracken/py-launchd/src/tip/PyLaunchd/PyLaunchdAge...
Thanks for that! Great! And so sorry that I cant help to point out any areas for improvement.
I'm glad it's useful, but credit where it's due - that particular function is basically straight out of Apple's BetterAuthorizationSample, which was really helpful for me: http://developer.apple.com/mac/library/samplecode/BetterAuthorizationSample/... If you want to make a ruby version of my sample code, feel free to grab it on bitbucket - I'd love to have it be more broadly useful. -mike
On Mon, Mar 15, 2010 at 2:31 AM, Michael McCracken <michael.mccracken@gmail.com> wrote:
Hi, I just spent some time figuring out how to get a launchd agent written in python (and using UNIX domain sockets) up and running.
I think this was asked previously on the list, and since it wasn't straightforward to figure out how to make it work, I decided to write a post about it and put up some public example code.
My post is here: http://michael-mccracken.net/2010/03/snakes-on-demand-how-to-write-a-python-...
The example code is on bitbucket here: http://bitbucket.org/mikemccracken/py-launchd/
I'd be interested to hear comments on how I've implemented it. In particular:
- I use a socket in /private/tmp/ but saw some comments saying that that might not be good for long-lived agents (mine won't be, but for sample code it might be better to use something else?)
- To avoid forcing a restart on first-run, I use system() to unload, then load the plist when my app starts up. This smells - what happens if I'm doing this while a second app is talking to a running instance of this agent? Is there a better way?
Thanks for any comments - I'm interested in updating my public code with the *right way* once I figure it out :)
Cheers, -mike _______________________________________________ launchd-dev mailing list launchd-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev