• 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: Emulating Leopard launchd.plist behavior under Tiger
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emulating Leopard launchd.plist behavior under Tiger


  • Subject: Re: Emulating Leopard launchd.plist behavior under Tiger
  • From: Terry Lambert <email@hidden>
  • Date: Tue, 07 Jul 2009 09:48:40 -0700

Use bundle-relative library names in your linkage so you don't need to use LD_LIBRARY_PATH in the first place.

    man install_name_tool

for more information.

-- Terry

On Jul 7, 2009, at 5:57 AM, Maxim Zhuravlev <email@hidden> wrote:

Hi, all.

I need the following launch daemon behavior both on Tiger and Leopard:
1) The daemon should support RunAtLoad set to true or false, both.
2) It should be kept alive unless exited successfully.
3) It should support launching on-demand.

As for Leopard, the following plist should do the job:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<dict>
    <key>EnvironmentVariables</key>
    <dict>
        <key>LD_LIBRARY_PATH</key>
        <string>/path/to/daemon/specific/libraries</string>
    </dict>
    <key>Label</key>
    <string>com.yourcompany.yourdaemon/string>
    <key>ProgramArguments</key>
    <array>
        <string>/path/to/daemon</string>
        <string>-arg1</string>
    </array>
    <key>RunAtLoad</key>
    <false/>
    <key>WorkingDirectory</key>
    <string>/path/to/working/directory</string>
    <key>MachServices</key>
        <dict>
             <key>com.yourcompany.yourdaemon.service</key>
             <true/>
        </dict>
    <key>KeepAlive</key>
        <dict>
             <key>SuccessfulExit</key>
             <false/>
        </dict>
</dict>
</plist>

As for Tiger, assume the following plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<dict>
    <key>EnvironmentVariables</key>
    <dict>
        <key>LD_LIBRARY_PATH</key>
        <string>/path/to/daemon/specific/libraries</string>
    </dict>
    <key>Label</key>
    <string>com.yourcompany.yourdaemon</string>
    <key>ProgramArguments</key>
    <array>
        <string>/path/to/daemon</string>
        <string>-arg1</string>
    </array>
    <key>RunAtLoad</key>
    <false/>
    <key>WatchPaths</key>
    <array>
        <string>/path/to/watch</string>
    </array>
    <key>WorkingDirectory</key>
    <string>/path/to/working/directory</string>
</dict>
</plist>

This plist doesn't implement keeping alive. I could implement it the
way most Tiger system daemons do - through bootstrap:
bootstrap_create_server() with on-demand set to false, then
bootstrap_create_service(), bootstrap_check_in(). On successful exit
bootstrap_register() service with MACH_PORT_NULL.
The problem is: I can't pass environment variables this way
(LD_LIBRARY_PATH specifically). Any solution?

Thanks in advance,
 - Maxim.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Emulating Leopard launchd.plist behavior under Tiger (From: Maxim Zhuravlev <email@hidden>)

  • Prev by Date: Re: ZFS support in Mac OS X "Snow Leopard"
  • Next by Date: Re: ZFS support in Mac OS X "Snow Leopard"
  • Previous by thread: Emulating Leopard launchd.plist behavior under Tiger
  • Next by thread: ZFS support in Mac OS X "Snow Leopard"
  • Index(es):
    • Date
    • Thread