aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorbkonkle2010-09-01 16:07:45 -0500
committerDavid Höppner2010-09-02 10:51:07 +0200
commitdc90787040bebfa419d831bba58022dccd8c23ab (patch)
tree479a78b55e6e09206d7a8d97befec228ca171afc /Library
parent6f43d723d47fab7fad02b64b980d26e6716a22f1 (diff)
downloadhomebrew-dc90787040bebfa419d831bba58022dccd8c23ab.tar.bz2
Added a launchd plist for nginx
Signed-off-by: David Höppner <0xffea@gmail.com> * white spaces
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/nginx.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/Library/Formula/nginx.rb b/Library/Formula/nginx.rb
index 4cf774a6b..3bdfde788 100644
--- a/Library/Formula/nginx.rb
+++ b/Library/Formula/nginx.rb
@@ -48,6 +48,8 @@ class Nginx < Formula
system "./configure", *args
system "make install"
+
+ (prefix+'org.nginx.plist').write startup_plist
end
def caveats
@@ -58,8 +60,40 @@ port is set to localhost:8080.
If you want to host pages on your local machine to the public, you should
change that to localhost:80, and run `sudo nginx`. You'll need to turn off
any other web servers running port 80, of course.
+
+You can start nginx automatically on login with:
+ cp #{prefix}/org.nginx.plist ~/Library/LaunchAgents
+ launchctl load -w ~/Library/LaunchAgents/org.nginx.plist
+
CAVEATS
end
+
+ def startup_plist
+ return <<-EOPLIST
+<?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>org.nginx</string>
+ <key>RunAtLoad</key>
+ <true/>
+ <key>KeepAlive</key>
+ <true/>
+ <key>UserName</key>
+ <string>#{`whoami`.chomp}</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>#{sbin}/nginx</string>
+ <string>-g</string>
+ <string>daemon off;</string>
+ </array>
+ <key>WorkingDirectory</key>
+ <string>#{HOMEBREW_PREFIX}</string>
+ </dict>
+</plist>
+ EOPLIST
+ end
end
__END__