You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by ar...@apache.org on 2017/03/16 23:18:54 UTC
svn commit: r1787270 -
/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/init/systemd.pm
Author: arkurth
Date: Thu Mar 16 23:18:54 2017
New Revision: 1787270
URL: http://svn.apache.org/viewvc?rev=1787270&view=rev
Log:
VCL-1027
Updated systemd.pm::add_ext_sshd_service to ensure the following lines exist under [Service] in /lib/systemd/system/ext_sshd.service:
StartLimitInterval=0
RestartSec=3s
Restart=on-failure
Modified:
vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/init/systemd.pm
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/init/systemd.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/init/systemd.pm?rev=1787270&r1=1787269&r2=1787270&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/init/systemd.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/init/systemd.pm Thu Mar 16 23:18:54 2017
@@ -611,10 +611,10 @@ sub add_ext_sshd_service {
# ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
$ext_sshd_service_file_contents =~ s/^\s*(ExecStart=.+\S)\s+\$\S*OPT\S*(.*)$/$1$2/gm;
- # Remove explicit -f arguments
+ # Remove explicit -f arguments from ExecStart line
$ext_sshd_service_file_contents =~ s/^\s*(ExecStart=.+\S)\s+-f\s+\S+(.*)$/$1$2/gm;
- # Add -f argument
+ # Add -f argument to ExecStart line
$ext_sshd_service_file_contents =~ s|^\s*(ExecStart=.+\S)\s*$|$1 -f /etc/ssh/external_sshd_config|gm;
# Set EnvironmentFile to /dev/null, service won't start if the file doesn't exist
@@ -626,6 +626,17 @@ sub add_ext_sshd_service {
# Failed to execute operation: Too many levels of symbolic links
$ext_sshd_service_file_contents =~ s/^\s*Alias=.*//gm;
+ # Add explicit lines, remove first to avoid duplicates:
+ $ext_sshd_service_file_contents =~ s/^\s*(Restart|RestartSec|StartLimitInterval)=.*\n?//gm;
+
+ # Attempt to restart if the service dies
+ $ext_sshd_service_file_contents =~ s/(\[Service\])/$1\nRestart=on-failure/gm;
+ $ext_sshd_service_file_contents =~ s/(\[Service\])/$1\nRestartSec=3s/gm;
+
+ # (VCL-1027) Add StartLimitInterval=0 under [Service] to prevent:
+ # Job for ext_sshd.service failed because start of the service was attempted too often
+ $ext_sshd_service_file_contents =~ s/(\[Service\])/$1\nStartLimitInterval=0/gm;
+
notify($ERRORS{'DEBUG'}, 0, "$ext_sshd_service_file_path:\n$ext_sshd_service_file_contents");
if (!$self->os->create_text_file($ext_sshd_service_file_path, $ext_sshd_service_file_contents)) {