[launchd-dev] KeepAlive / NetworkState

Arjun SM arjun.sm at gmail.com
Sun Mar 29 22:27:31 PDT 2009


Try using Lingon, this is graphical user interface in writing or editing
launchd configuration file. http://www.tuppis.com/lingon/ It would also
catch all the errors you are making while writing the config file.

On Sat, Mar 28, 2009 at 8:19 PM, Nigel Kersten <nigel at explanatorygap.net>wrote:

> I've definitely used it before.  It doesn't always do exactly what I
> want, but it's reliable enough.
>
> $ head -n 13 /System/Library/LaunchDaemons/nmbd.plist
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
> "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
> <plist version="1.0">
> <dict>
>        <key>Disabled</key>
>        <true/>
>         <key>KeepAlive</key>
>        <dict>
>                <key>NetworkState</key>
>                <true/>
>        </dict>
>         <key>Label</key>
>        <string>org.samba.nmbd</string>
>
>
> So nmbd is using it under 10.5. You sure there's not an error in the
> plist layout somewhere else?
>
>
> On Sat, Mar 28, 2009 at 4:48 AM, Keith Mountin <mountin at mac.com> wrote:
> > I am working on a launchd script to keep VNC alive.  We are having
> > difficulty using the KeepAlive key with NetworkState.
> >
> > According to the man pages:
> >
> > KeepAlive <boolean or dictionary of stuff>
> >
> > This optional key is used to control whether your job is to be kept
> > continuously running or to let demand and conditions
> > control the invocation. The default is false and therefore only demand
> > will start the job. The value may be set to true to
> > unconditionally keep the job alive. Alternatively, a dictionary of
> > conditions may be specified to selectively control
> > whether launchd keeps a job alive or not. If multiple keys are provided,
> > launchd ORs them, thus providing maximum flexibil-
> > ity to the job to refine the logic and stall if necessary. If launchd
> > finds no reason to restart the job, it falls back on
> > demand based invocation. Jobs that exit quickly and frequently when
> > configured to be kept alive will be throttled to con-
> > verve system resources.
> >
> > SuccessfulExit <boolean>
> >
> > If true, the job will be restarted as long as the program exits and with
> > an exit status of zero. If false, the job
> > will be restarted in the inverse condition. This key implies that
> > "RunAtLoad" is set to true, since the job needs to
> > run at least once before we can get an exit status.
> >
> > NetworkState <boolean>
> >
> > If true, the job will be kept alive as long as the network is up, where
> > up is defined as at least one non-loopback
> > interface being up and having IPv4 or IPv6 addresses assigned to them.
> > If false, the job will be kept alive in the
> > inverse condition.
> >
> > But if I use
> >
> >        <key>KeepAlive</key>
> >        <dict>
> >                <key>NetworkState</key>
> >                <true/>
> >        </dict>
> >
> > I get
> >
> >  "Unknown key for boolean: NetworkState"
> >
> > Does launchd actually support
> >
> >        <key>KeepAlive</key>
> >        <dict>
> >                <key>NetworkState</key>
> >                <true/>
> >        </dict>
> >
> > Thank you,
> >
> > Keith
> >
> > _______________________________________________
> > launchd-dev mailing list
> > launchd-dev at lists.macosforge.org
> > http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev
> >
> _______________________________________________
> launchd-dev mailing list
> launchd-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/launchd-dev/attachments/20090330/29c75ed8/attachment.html>


More information about the launchd-dev mailing list