3
0
Fork 0
forked from mirrors/nixpkgs

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

@ -213,33 +213,30 @@ while (my ($unit, $state) = each %{$activePrev}) {
elsif (!boolIsTrue($unitInfo->{'X-RestartIfChanged'} // "yes") || boolIsTrue($unitInfo->{'RefuseManualStop'} // "no") ) {
$unitsToSkip{$unit} = 1;
} else {
# If this unit is socket-activated, then stop the
# socket unit(s) as well, and restart the
# socket(s) instead of the service.
my $socketActivated = 0;
if ($unit =~ /\.service$/) {
my @sockets = split / /, ($unitInfo->{Sockets} // "");
if (scalar @sockets == 0) {
@sockets = ("$baseName.socket");
}
foreach my $socket (@sockets) {
if (defined $activePrev->{$socket}) {
$unitsToStop{$unit} = 1;
$unitsToStart{$unit} = 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 this unit is socket-activated, then stop the
# socket unit(s) as well, and restart the
# socket(s) instead of the service.
my $socketActivated = 0;
if ($unit =~ /\.service$/) {
my @sockets = split / /, ($unitInfo->{Sockets} // "");
if (scalar @sockets == 0) {
@sockets = ("$baseName.socket");
}
foreach my $socket (@sockets) {
if (defined $activePrev->{$socket}) {
$unitsToStop{$socket} = 1;
$unitsToStart{$socket} = 1;
recordUnit($startListFile, $socket);
$socketActivated = 1;
}
}
}
# If the unit is not socket-activated, record
# that this unit needs to be started below.
@ -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" ];