kafka: add plist

as suggested by Homebrew/homebrew#38898. stdout & stderr are recorded in
var/log/kafka/kafka_output.log.

Closes Homebrew/homebrew#39071.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Jason Boyles 2015-04-26 01:09:03 -05:00 committed by Mike McQuaid
parent f3ae0b34b8
commit c2d7c3129b

View file

@ -52,6 +52,9 @@ class Kafka < Formula
mv "config", "kafka"
etc.install "kafka"
libexec.install_symlink etc/"kafka" => "config"
# create directory for kafka stdout+stderr output logs when run by launchd
(var+"log/kafka").mkpath
end
def caveats; <<-EOS.undent
@ -77,4 +80,31 @@ class Kafka < Formula
system "./run_sanity.sh"
end
end
def plist; <<-EOS.undent
<?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>Label</key>
<string>#{plist_name}</string>
<key>WorkingDirectory</key>
<string>#{HOMEBREW_PREFIX}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/kafka-server-start.sh</string>
<string>#{etc}/kafka/server.properties</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardErrorPath</key>
<string>#{var}/log/kafka/kafka_output.log</string>
<key>StandardOutPath</key>
<string>#{var}/log/kafka/kafka_output.log</string>
</dict>
</plist>
EOS
end
end