[launchd-dev] Attempting to develop a launch plist for

Morgan Aldridge morgant at makkintosshu.com
Thu Aug 7 09:55:06 PDT 2008


On Tue, 5 Aug 2008 09:46:55 +0100, Quinn wrote:
>
> As long as you still need to support 10.4.x you'd be better off just
> using "OnDemand".  It's supported, albeit deprecated, on 10.5.

Well, the StartupItem still works under Tiger, so I'll just drop
support for that in the launchd plist. The "KeepAlive" functionality
is much more worthwhile to me than getting rid of the StartupItem
under Tiger.

Incidentally--and a bit off-topic--is there an easy way to get the Mac
OS X/Darwin version number from a bash script so I can install either
the StartupItem of launchd plist? I think I saw one once, but the only
thing that immediately comes to mind is to parse the output of
`hostinfo` and I don't like that idea. I can ask on darwin-dev if
that's more appropriate.

> My guess is that this is related to networking.  Startup items, since
> 10.4, have automatically been given a dependency on networking for
> compatibility reasons.  If you convert to launchd, you lose that
> dependency and it's likely you come up /way/ before the networking
> stack.  Lots of traditional UNIX code doesn't handle that well.

I'll try to look at the sysmond source and see what checks the
original author was doing in terms of the networking side of things.
You're probably right that it's likely very little and/or doesn't
handle it gracefully.

> Just for the sake of debugging this, have you tried adding
> "NetworkState" to your property list (in the "KeepAlive" dictionary,
> as documented by <x-man-page://5/launchd.plist>).  This will prevent
> you from coming up until the network is up.  It's not the long-term
> solution to this problem, but it would allow you determine whether
> the problem is networking or something else.

I had looked at that key, but hadn't tried it yet. I'll give it a shot
and see what results I get.

I'm assuming--please correct me if I'm wrong--that that will kill the
sysmond process if the network goes down? If so, it's definitely not a
long term solution as sysmon is a network monitoring utility. ;)

Morgan Aldridge
---
morgant at makkintosshu.com
http://www.makkintosshu.com/


More information about the launchd-dev mailing list