diff options
author | Azul <azul@riseup.net> | 2014-07-01 10:20:24 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2014-07-01 10:20:24 +0200 |
commit | aac4577031728dab84f077b54e461fcb813ac0c3 (patch) | |
tree | 43766ce7212f3f47e4ed3d8e3979721a810167fb /bin | |
parent | 478cd9faf5fb78b2f9905ec098827d4c4188c19d (diff) |
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.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/tapicero | 11 |
1 files changed, 6 insertions, 5 deletions
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 |