Files
podman/contrib/systemd/system/podman-restart.service.in
Andrew Sayers 527a51dcc4 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 <andrew-github.com@pileofstuff.org>
2025-01-27 14:53:35 +00:00

17 lines
460 B
SYSTEMD

[Unit]
Description=Podman Start All Containers With Restart Policy Set To Always
Documentation=man:podman-start(1)
StartLimitIntervalSec=0
Wants=network-online.target
After=network-online.target
[Service]
Type=oneshot
RemainAfterExit=true
Environment=LOGGING="--log-level=info"
ExecStart=@@PODMAN@@ $LOGGING start --all --filter restart-policy=always
ExecStop=@@PODMAN@@ $LOGGING stop --all --filter restart-policy=always
[Install]
WantedBy=default.target