Re: Emulating Leopard launchd.plist behavior under Tiger
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com man install_name_tool for more information. -- Terry 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 (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/tlambert%40apple.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... Use bundle-relative library names in your linkage so you don't need to use LD_LIBRARY_PATH in the first place. On Jul 7, 2009, at 5:57 AM, Maxim Zhuravlev <maxim.zhuravlev@gmail.com> wrote: This email sent to tlambert@apple.com This email sent to site_archiver@lists.apple.com
participants (1)
-
Terry Lambert