site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Thread-index: AckyvN9x/TyK7zLHRmWVuAJ00vOQuwACHFgg Thread-topic: lanuchd questions Actually, I like that method quite a bit; I can make the first program run once at launch, and have it store the configuration files it generates in /var/run. The other scripts can use the PathState key to watch for the files in /var/run that the first one is generating, which means that they won't launch until the first program is done. And that solves all my problems in one go. Thanks! Thanks, Cem Karan
-----Original Message----- From: Dave Zarzycki [mailto:zarzycki@apple.com] Sent: Monday, October 20, 2008 10:05 AM To: Karan, Cem (Civ, ARL/CISD) Cc: darwin-dev@lists.apple.com Subject: Re: lanuchd questions
Karen,
A cheesy way to accomplish this goal would be leverage the launchd conditional keep alive logic and the fact that /var/run is guaranteed to be cleaned at boot. This would involve breaking each daemon out into a separate launchd job that is conditionally kept alive whenever / var/run/my-script-is-done exists. The script on the other hand, is also a launchd job, and is kept alive as long as /var/run/my-script-is- done does NOT exist. This script MUST "touch" /var/run/my-script-is- done to signal launchd to stop relaunching the script and begin relaunching the daemons.
For the daemons:
<key>KeepAlive</key> <dict> <key>PathState</key> <dict> <key>/var/run/my-script-is-done</key> <true/> </dict> </dict>
For the script:
<key>KeepAlive</key> <dict> <key>PathState</key> <dict> <key>/var/run/my-script-is-done</key> <false/> </dict> </dict>
davez
On Oct 20, 2008, at 4:53 AM, Karan, Cem (Civ, ARL/CISD) wrote:
I hope this is the right list for these questions, if not, please tell me where I should go.
I'm working on integrating a set of Linux programs into our product on the mac, and, as in any porting job, I'm having certain problems getting everything to work just right. In this case, the Linux application is actually a set of programs, each of which does a different job, in a particular order. The first program must be run exactly once, before the other programs are run. It creates a set of files that the other programs parse and use while they are running. These other programs are effectively daemons (which have a -nofork option, so they will work with launchd), and need to be kept alive. This means that I can't just write one script that launches them in order, because then the parameters I pass to launchd will either keep the whole script alive, or run it just once. So, what is the best way of forcing the scripts to run in the particular order I want them to run in?
Thanks, Cem Karan
_______________________________________________ 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/zarzycki%40apple.com
This email sent to zarzycki@apple.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... This email sent to site_archiver@lists.apple.com