RE: pipes, scripts, and launchd
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Thread-index: AchJqGm8YRrnDqJSTquJBpe37OC/zwAArEef Thread-topic: pipes, scripts, and launchd I had a similar situation where we had to create a symbolic link at startup, in Leopard, where there's only launchd. Here's my 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>Debug</key> <false/> <key>Label</key> <string>com.mycompany.f5-prep</string> <key>OnDemand</key> <false/> <key>ProgramArguments</key> <array> <string>/bin/ln</string> <string>-s</string> <string>/var/run/DirectoryService.pid</string> <string>/var/run/lookupd.pid</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist> just keep each flag to postgres on a seperate <string></string> line. Something like: <?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>Debug</key> <false/> <key>Label</key> <string>com.yourcompany.rotatelogs</string> <key>OnDemand</key> <false/> <key>ProgramArguments</key> <array> <string>postgres</string> <string>args</string> <string>|</string> <string>rotatelogs</string> <string>args</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist> ought to work. I believe it just launchd will pass the <strings> verbatim, so launchd would end up generating the same command you typed below. worth a try, at least... -----Original Message----- From: darwin-dev-bounces+bhuntsman=mail2.cu-portland.edu@lists.apple.com on behalf of Dave Zarzycki Sent: Fri 12/28/2007 3:25 PM To: Perry Smith Cc: darwin-dev@lists.apple.com Subject: Re: pipes, scripts, and launchd I haven't tested this, but I suspect it should work... Setup: mkfifo /var/postgres_pipe Job 1: Have postgres write to /var/postgres_pipe via the launchd plist StandardOutPath and StandardErrorPath keys. Job 2: #!/bin/sh exec rotatelogs < /var/postgres_pipe # Note to self: It would have been nice if launchd supported a StandardInputPath configuration option davez On Dec 28, 2007, at 8:44 AM, Perry Smith wrote:
I may be making too big a deal of all this but I can't figure out how to do something like:
postgres <args> | rotatelogs <args>
from launchd. If I put that command in a simple bash shell script, I *believe* it will not work. The signal will go to bash and bash will not pass it along to the children.
I could trap the signal and pass it along myself... but, $! gives the pid for the last process in the pipe (rotatelogs). That is not what I need to signal. I need the signal passed to postgres. And, in fact, it would be nice if the signal did NOT pass to rotatelogs. I'd like for it to stop when its input closes and not before then.
I'm going to look in to using ksh and maybe using co-processes with ksh. bash does not seem to have that concept. But, it just seems like it should not be this hard to do.
Anyone have any suggestions of how to do this?
Thank you, pedz
_______________________________________________ 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/bhuntsman%40mail2.cu-portl... This email sent to bhuntsman@mail2.cu-portland.edu _______________________________________________ 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)
-
Benjamin Huntsman