Permalink
Browse files

add nginx pid as a configurable attribute

  • Loading branch information...
1 parent 4a38a86 commit 9ee2dfbf99156c3a04651c83e28a63070a3ae380 @reset reset committed with jtimberman Feb 2, 2012
Showing with 8 additions and 5 deletions.
  1. +2 −0 attributes/default.rb
  2. +4 −3 recipes/source.rb
  3. +1 −1 templates/default/nginx.conf.erb
  4. +1 −1 templates/default/nginx.pill.erb
View
@@ -37,6 +37,8 @@
default[:nginx][:init_style] = "init"
end
+default[:nginx][:pid] = "/var/run/nginx.pid"
+
default[:nginx][:gzip] = "on"
default[:nginx][:gzip_http_version] = "1.0"
default[:nginx][:gzip_comp_level] = "2"
View
@@ -87,7 +87,7 @@
service "nginx" do
supports :status => true, :restart => true, :reload => true
- reload_command "if [ -f /var/run/nginx.pid ]; then kill -HUP `cat /var/run/nginx.pid`; fi"
+ reload_command "if [ -f #{node[:nginx][:pid]} ]; then kill -HUP `cat #{node[:nginx][:pid]}`; fi"
subscribes :restart, resources(:bash => "compile_nginx_source")
end
when "bluepill"
@@ -102,7 +102,8 @@
:working_dir => node[:nginx][:install_path],
:src_binary => node[:nginx][:src_binary],
:nginx_dir => node[:nginx][:dir],
- :log_dir => node[:nginx][:log_dir]
+ :log_dir => node[:nginx][:log_dir],
+ :pid => node[:nginx][:pid]
)
end
@@ -113,7 +114,7 @@
service "nginx" do
supports :status => true, :restart => true, :reload => true
- reload_command "if [ -f /var/run/nginx.pid ]; then kill -HUP `cat /var/run/nginx.pid`; fi"
+ reload_command "if [ -f #{node[:nginx][:pid]} ]; then kill -HUP `cat #{node[:nginx][:pid]}`; fi"
action :nothing
end
else
@@ -5,7 +5,7 @@ daemon off;
<% end -%>
error_log <%= node[:nginx][:log_dir] %>/error.log;
-pid /var/run/nginx.pid;
+pid <%= node[:nginx][:pid] %>;
events {
worker_connections <%= node[:nginx][:worker_connections] %>;
@@ -1,6 +1,6 @@
Bluepill.application("nginx", :log_file => "<%= @log_dir %>/bluepill-nginx.log") do |app|
app.process("nginx") do |process|
- process.pid_file = "/var/run/nginx.pid"
+ process.pid_file = "<%= @pid %>"
process.working_dir = "<%= @working_dir %>"
process.start_command = "<%= @src_binary %> -c <%= @nginx_dir %>/nginx.conf"
process.stop_command = "kill -QUIT {{PID}}"

0 comments on commit 9ee2dfb

Please sign in to comment.