diff --git a/manifests/service/systemd.pp b/manifests/service/systemd.pp index f17dc0a44..ac54ed406 100644 --- a/manifests/service/systemd.pp +++ b/manifests/service/systemd.pp @@ -163,6 +163,18 @@ $memlock = undef } + # Systemd automatic restart feature + if ($new_init_defaults != undef and is_hash($new_init_defaults) and has_key($new_init_defaults, 'SYSTEMD_RESTART')) { + $systemd_restart = $new_init_defaults['SYSTEMD_RESTART'] + }else{ + $systemd_restart = undef + } + if ($new_init_defaults != undef and is_hash($new_init_defaults) and has_key($new_init_defaults, 'SYSTEMD_RESTART_SEC')) { + $systemd_restart_sec = $new_init_defaults['SYSTEMD_RESTART_SEC'] + }else{ + $systemd_restart_sec = undef + } + file { "${elasticsearch::params::systemd_service_path}/elasticsearch-${name}.service": ensure => $ensure, content => template($init_template), diff --git a/templates/etc/init.d/elasticsearch.systemd.erb b/templates/etc/init.d/elasticsearch.systemd.erb index e72546241..8b771b5ab 100644 --- a/templates/etc/init.d/elasticsearch.systemd.erb +++ b/templates/etc/init.d/elasticsearch.systemd.erb @@ -19,6 +19,8 @@ LimitMEMLOCK=<%= @memlock %> <% end %> # Shutdown delay in seconds, before process is tried to be killed with KILL (if configured) TimeoutStopSec=20 +<% if @systemd_restart %>Restart=<%= @systemd_restart %><% end %> +<% if @systemd_restart_sec %>RestartSec=<%= @systemd_restart_sec %><% end %> [Install] WantedBy=multi-user.target