From 95ee79200126948aedba741956d98f59ce6b9c29 Mon Sep 17 00:00:00 2001 From: James Thompson Date: Tue, 10 Oct 2017 16:43:27 -0600 Subject: [PATCH] nsq: add plist for service management Closes #19339. Signed-off-by: JCount --- Formula/nsq.rb | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Formula/nsq.rb b/Formula/nsq.rb index 37d190a09f1..73dae77bb90 100644 --- a/Formula/nsq.rb +++ b/Formula/nsq.rb @@ -4,6 +4,7 @@ class Nsq < Formula url "https://github.com/nsqio/nsq/archive/v1.0.0-compat.tar.gz" version "1.0.0" sha256 "c279d339eceb84cad09e2c2bc21e069e37988d0f6b7343d77238374081c9fd29" + revision 1 head "https://github.com/nsqio/nsq.git" bottle do @@ -25,6 +26,40 @@ class Nsq < Formula system "make", "DESTDIR=#{prefix}", "PREFIX=", "install" end + def post_install + (var/"log").mkpath + (var/"nsq").mkpath + end + + plist_options :manual => "nsqd -data-path=#{HOMEBREW_PREFIX}/var/nsq" + + def plist; <<-EOS.undent + + + + + KeepAlive + + Label + #{plist_name} + ProgramArguments + + #{bin}/nsqd + -data-path=#{var}/nsq + + RunAtLoad + + WorkingDirectory + #{var}/nsq + StandardErrorPath + #{var}/log/nsqd.error.log + StandardOutPath + #{var}/log/nsqd.log + + + EOS + end + test do begin lookupd = fork do