From 527a51dcc420eae23310139b4283f03b30c12ddf Mon Sep 17 00:00:00 2001 From: Andrew Sayers Date: Mon, 27 Jan 2025 14:53:35 +0000 Subject: [PATCH] Fix podman-restart.service when there are no containers If no containers need to be restarted, podman-restart prints "Error: you must provide at least one name or id" then fails. Update the service file to handle start and stop symmetrically. See discussion in https://github.com/containers/podman/pull/25131 Signed-off-by: Andrew Sayers --- contrib/systemd/system/podman-restart.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/systemd/system/podman-restart.service.in b/contrib/systemd/system/podman-restart.service.in index de02493815..0f1401836f 100644 --- a/contrib/systemd/system/podman-restart.service.in +++ b/contrib/systemd/system/podman-restart.service.in @@ -10,7 +10,7 @@ Type=oneshot RemainAfterExit=true Environment=LOGGING="--log-level=info" ExecStart=@@PODMAN@@ $LOGGING start --all --filter restart-policy=always -ExecStop=/bin/sh -c '@@PODMAN@@ $LOGGING stop $(@@PODMAN@@ container ls --filter restart-policy=always -q)' +ExecStop=@@PODMAN@@ $LOGGING stop --all --filter restart-policy=always [Install] WantedBy=default.target