diff --git a/export/upstart/master.conf.erb b/export/upstart/master.conf.erb index 06d8787..96a7c64 100644 --- a/export/upstart/master.conf.erb +++ b/export/upstart/master.conf.erb @@ -1,8 +1,8 @@ pre-start script bash << "EOF" - mkdir -p /var/log/<%= app %> - chown -R <%= user %> /var/log/<%= app %> + mkdir -p <%= log_root %>/<%= app %> + chown -R <%= user %> <%= log_root %>/<%= app %> EOF end script diff --git a/export/upstart/process.conf.erb b/export/upstart/process.conf.erb index a545369..05230e3 100644 --- a/export/upstart/process.conf.erb +++ b/export/upstart/process.conf.erb @@ -3,4 +3,4 @@ stop on stopping <%= app %>-<%= process.name %> respawn chdir <%= engine.directory %> -exec su <%= user %> -c "<%= process.command %> >> /var/log/<%=app%>/<%=process.name%>-<%=num%>.log 2>&1" +exec su <%= user %> -c "<%= process.command %> >> <%= log_root %>/<%=app%>/<%=process.name%>-<%=num%>.log 2>&1" diff --git a/lib/foreman/cli.rb b/lib/foreman/cli.rb index 537a871..37c0e94 100644 --- a/lib/foreman/cli.rb +++ b/lib/foreman/cli.rb @@ -26,6 +26,7 @@ class Foreman::CLI < Thor desc "export FORMAT LOCATION", "Export the application to another process management format" method_option :app, :type => :string, :aliases => "-a" + method_option :log, :type => :string, :aliases => "-l" method_option :user, :type => :string, :aliases => "-u" method_option :concurrency, :type => :string, :aliases => "-c", :banner => '"alpha=5,bar=3"' @@ -41,6 +42,7 @@ class Foreman::CLI < Thor formatter.new(engine).export(location, :name => options[:app], :user => options[:user], + :log => options[:log], :concurrency => options[:concurrency] ) rescue Foreman::Export::Exception => ex diff --git a/lib/foreman/export/inittab.rb b/lib/foreman/export/inittab.rb index 5314073..05810f1 100644 --- a/lib/foreman/export/inittab.rb +++ b/lib/foreman/export/inittab.rb @@ -5,7 +5,9 @@ class Foreman::Export::Inittab < Foreman::Export::Base def export(fname=nil, options={}) app = options[:app] || File.basename(engine.directory) user = options[:user] || app - log_dir = "/var/log/#{app}" + log_root = options[:log] || "/var/log" + + log_dir = "#{log_root}/#{app}" concurrency = parse_concurrency(options[:concurrency]) diff --git a/lib/foreman/export/upstart.rb b/lib/foreman/export/upstart.rb index 810ab17..b2770d2 100644 --- a/lib/foreman/export/upstart.rb +++ b/lib/foreman/export/upstart.rb @@ -10,6 +10,7 @@ class Foreman::Export::Upstart < Foreman::Export::Base app = options[:app] || File.basename(engine.directory) user = options[:user] || app + log_root = options[:log] || "/var/log" Dir["#{location}/#{app}*.conf"].each do |file| say "cleaning up: #{file}" diff --git a/man/foreman.1.ronn b/man/foreman.1.ronn index 8c80e0f..e479c6a 100644 --- a/man/foreman.1.ronn +++ b/man/foreman.1.ronn @@ -43,6 +43,9 @@ The following options control how the application is run: Use this name rather than the application's root directory name as the name of the application when exporting. + * `-l`, `--log`: + Specify the directory to place process logs in. + * `-c`, `--concurrency`: Specify the number of each process type to run. The value passed in should be in the format `process=num,process=num`