summaryrefslogtreecommitdiff
path: root/pkg/systemdgen/systemdgen.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2020-01-16 15:46:39 +0100
committerValentin Rothberg <rothberg@redhat.com>2020-01-16 16:36:21 +0100
commit9d3667c2f025e1e36f3fdbd7348e0e14d00e336d (patch)
tree2c5b2ce726f1cc0de69097b8a45b9a25241a1bf8 /pkg/systemdgen/systemdgen.go
parentdb00ee97e950290a6bc5d669cde0cbc54bb94afe (diff)
downloadpodman-9d3667c2f025e1e36f3fdbd7348e0e14d00e336d.tar.gz
podman-9d3667c2f025e1e36f3fdbd7348e0e14d00e336d.tar.bz2
podman-9d3667c2f025e1e36f3fdbd7348e0e14d00e336d.zip
systemdgen: add --ignore flag to generic services
The --ignore flag lets Podman ignore errors when a specified container does not exist (anymore). That's a nice addition to generic services generated via the --new flag. Those services create new containers and can hence allows user to manually remove a container; may it only be by accident. The important part of using the --ignore flag is that Podman will exit 0 which plays nicer with most restart policies; a non-zero exit may yield systemd to restart the entire service which is arguably wrong if the user manually deletes the container. If desired, users can still alter the generated files. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg/systemdgen/systemdgen.go')
-rw-r--r--pkg/systemdgen/systemdgen.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/systemdgen/systemdgen.go b/pkg/systemdgen/systemdgen.go
index b6167a23e..745b708e4 100644
--- a/pkg/systemdgen/systemdgen.go
+++ b/pkg/systemdgen/systemdgen.go
@@ -96,8 +96,8 @@ Restart={{.RestartPolicy}}
{{- if .New}}
ExecStartPre=/usr/bin/rm -f /%t/%n-pid /%t/%n-cid
ExecStart={{.RunCommand}}
-ExecStop={{.Executable}} stop --cidfile /%t/%n-cid {{if (ge .StopTimeout 0)}}-t {{.StopTimeout}}{{end}}
-ExecStopPost={{.Executable}} rm -f --cidfile /%t/%n-cid
+ExecStop={{.Executable}} stop --ignore --cidfile /%t/%n-cid {{if (ge .StopTimeout 0)}}-t {{.StopTimeout}}{{end}}
+ExecStopPost={{.Executable}} rm --ignore -f --cidfile /%t/%n-cid
PIDFile=/%t/%n-pid
{{- else}}
ExecStart={{.Executable}} start {{.ContainerName}}