Emulating Leopard launchd.plist behavior under Tiger
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=UKE2yiR4Lgqm1byLC+r2uJPd+iIuqDlpHnwXYtdehfo=; b=OXcw6JxzR64hYGngQntEHDHwNlpRWYOAdAQvHPenGpR6wODYeUr2rQ0QLu8ttARJ8f aWRsrSkDLpXsP5sCPz6Gy7NY6H+wlNIdZgcz0FP6NEOiq1ooTFn7Myoo5LwGouRMtaCt wCuLfo3EsYgyZcxixo1pL26XelAKPWZEv9yTs= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=u5dyz19aVeTHsloe0kMmhgnuwxj29lYoftWR9VW9+s4C0SYw8wFwnhN0x9Qhmy5Kw+ 7MBOqBHsDnPsrdYpqXvhuz+lH2mGoLua0ySPsvb4GM2iAJLeLMooKAl+2O0uEGcTIxxr HINAp3A6n1oALcrmG9wI8HPwgXLk6ksjNpvlM= 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/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Maxim Zhuravlev