From aac4577031728dab84f077b54e461fcb813ac0c3 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 1 Jul 2014 10:20:24 +0200 Subject: pid issue remains to be solved - revert to sth working We've seen two instances of tapicero running on the production servers. The reason is that we are using two different places for the pid file - one for root and one for a normal user. In this scenario tapicero started by root will not notice the tapicero run as a normal user and vice versa. One idea was to solve this by always using /var/run/pid. However this also requires write privileges to that place which essentially only root has. So let's keep the two different places and just make sure we ALWAYS run tapicero as the same user. --- bin/tapicero | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'bin') diff --git a/bin/tapicero b/bin/tapicero index 658dace..72f974b 100755 --- a/bin/tapicero +++ b/bin/tapicero @@ -51,7 +51,7 @@ Tapicero::CONFIGS.concat ARGV.grep(/\.ya?ml$/) # if flags have been set but an action is missing we assume # tapicero should run in foreground. -if ARGV.first && ARGV.first.start_with?('--') +if ARGV.first.start_with?('--') ARGV.unshift '--' ARGV.unshift 'run' end @@ -61,10 +61,11 @@ end # Start the daemon # require 'daemons' - -# this will put the pid file in /var/run -options = {:app_name => 'tapicero', :dir_mode => :system} - +if ENV["USER"] == "root" + options = {:app_name => 'tapicero', :dir_mode => :system} # this will put the pid file in /var/run +else + options = {:app_name => 'tapicero', :dir_mode => :normal, :dir => '/tmp'} # this will put the pid file in /tmp +end begin Daemons.run("#{BASE_DIR}/lib/tapicero_daemon.rb", options) rescue SystemExit -- cgit v1.2.3