[launchd-dev] Launchd and python

dreamcat four dreamcat4 at gmail.com
Mon Mar 15 05:04:27 PDT 2010


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/PyLaunchdAgent_main.m#cl-112

Thanks for that! Great!
And so sorry that I cant help to point out any areas for improvement.


On Mon, Mar 15, 2010 at 2:31 AM, Michael McCracken
<michael.mccracken at 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-launchd-agent/
>
> 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 at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev
>


More information about the launchd-dev mailing list