Merge pull request #19108 from abbradar/journald-restart

Fix restart of socket-activated services, particularly journald
This commit is contained in:
Eelco Dolstra 2016-09-30 17:31:14 +02:00 committed by GitHub
commit d454f9cca2
2 changed files with 20 additions and 22 deletions

View File

@ -212,6 +212,12 @@ while (my ($unit, $state) = each %{$activePrev}) {
}
elsif (!boolIsTrue($unitInfo->{'X-RestartIfChanged'} // "yes") || boolIsTrue($unitInfo->{'RefuseManualStop'} // "no") ) {
$unitsToSkip{$unit} = 1;
} else {
if (!boolIsTrue($unitInfo->{'X-StopIfChanged'} // "yes")) {
# This unit should be restarted instead of
# stopped and started.
$unitsToRestart{$unit} = 1;
recordUnit($restartListFile, $unit);
} else {
# If this unit is socket-activated, then stop the
# socket unit(s) as well, and restart the
@ -224,23 +230,14 @@ while (my ($unit, $state) = each %{$activePrev}) {
}
foreach my $socket (@sockets) {
if (defined $activePrev->{$socket}) {
$unitsToStop{$unit} = 1;
$unitsToStart{$unit} = 1;
$unitsToStop{$socket} = 1;
$unitsToStart{$socket} = 1;
recordUnit($startListFile, $socket);
$socketActivated = 1;
}
}
}
if (!boolIsTrue($unitInfo->{'X-StopIfChanged'} // "yes")) {
# This unit should be restarted instead of
# stopped and started.
$unitsToRestart{$unit} = 1;
recordUnit($restartListFile, $unit);
} else {
# If the unit is not socket-activated, record
# that this unit needs to be started below.
# We write this to a file to ensure that the
@ -251,7 +248,6 @@ while (my ($unit, $state) = each %{$activePrev}) {
}
$unitsToStop{$unit} = 1;
}
}
}

View File

@ -808,6 +808,8 @@ in
systemd.services.systemd-user-sessions.restartIfChanged = false; # Restart kills all active sessions.
systemd.services.systemd-logind.restartTriggers = [ config.environment.etc."systemd/logind.conf".source ];
systemd.services.systemd-logind.stopIfChanged = false;
systemd.services.systemd-journald.restartTriggers = [ config.environment.etc."systemd/journald.conf".source ];
systemd.services.systemd-journald.stopIfChanged = false;
systemd.targets.local-fs.unitConfig.X-StopOnReconfiguration = true;
systemd.targets.remote-fs.unitConfig.X-StopOnReconfiguration = true;
systemd.services.systemd-binfmt.wants = [ "proc-sys-fs-binfmt_misc.automount" ];