Avoid forks when starting hekad
We must avoid to fork process when starting the Heka daemon because if we kill the wrapper, the Heka daemon is detached and re-attach to the init process. This can create several Heka daemon. To avoid this we need to use exec and avoid the usage of sudo. Fixes-bug: #1561109 Change-Id: Idbfab2de92b993d1e5124de5bff44c4b09a88bb4
This commit is contained in:
parent
01c6fd5820
commit
f0ba5e5077
|
@ -22,7 +22,7 @@ describe 'heka' do
|
|||
describe 'with defaults' do
|
||||
it { is_expected.to contain_user('heka') }
|
||||
it { is_expected.to contain_file('/etc/init/hekad.conf') \
|
||||
.with_content(/sudo -u heka/) }
|
||||
.with_content(/--user heka/) }
|
||||
end
|
||||
|
||||
describe 'with user => "root"' do
|
||||
|
@ -32,6 +32,6 @@ describe 'heka' do
|
|||
it { is_expected.to contain_user('root') }
|
||||
it { is_expected.to contain_file('/etc/init/hekad.conf') }
|
||||
it { is_expected.not_to contain_file('/etc/init/hekad.conf') \
|
||||
.with_content(/sudo -u/) }
|
||||
.with_content(/--user/) }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,5 +17,5 @@ end script
|
|||
script
|
||||
# https://bugs.launchpad.net/lma-toolchain/+bug/1543289
|
||||
ulimit -n 102400
|
||||
exec <%= @run_as_root ? "" : "sudo -u #{ @heka_user }" %> <%= @hekad_wrapper %> 2>><%= @log_file %>
|
||||
exec start-stop-daemon --start <%= @run_as_root ? "" : " --user #{ @heka_user }" %> --exec <%= @hekad_wrapper %> 2>><%= @log_file %>
|
||||
end script
|
||||
|
|
|
@ -6,4 +6,4 @@ HEKAD="/usr/bin/hekad"
|
|||
<%= @pre_script %>
|
||||
<% end -%>
|
||||
|
||||
$HEKAD -config=<%= @config_dir %>
|
||||
exec $HEKAD -config=<%= @config_dir %>
|
||||
|
|
Loading…
Reference in New Issue